Device Filters
1 min read

As I mentioned in my CSS Adapters Beta 2 entry, the asp:Menu control does not work well with Safari. As I was trying to research how to make the control compatible ( before I knew about the CSS Adapaters ), I searched Google for workarounds and found the article Using Device Filters ( and making Menu work with Safari ). This was a new feature in ASP.NET 2.0 that I had never heard before. Using device filters you can prepend a browser type to your aspx tag attributes to change the behavior of the tag.

For example you can do the following:

<span>IE:Text</span><span>="Hello Internet Explorer"</span>
<span>Mozilla:Text</span><span>="Hello Mozilla"</span>
<span>Safari:Text</span><span>="Hello Safari"</span> <span>/></span>

Althought probably not useful, when viewed the above code will display "Hello Internet Explorer" if you viewed the page with IE, "Hello Mozilla" if you viewed the page with Firefox, and etc...

The device filters use the same Browser Definition File Schema information that I shared in my HttpBrowserCapabilities entry.

Unfortuantely, I wasn't able to get the menu to look like I wanted in Safari using device filters, but it did enlighten me to the new feature.

Edit post on GitHub

Ready for IE7?
CSS Adapaters Beta 2