Better BrowserCaps file
Scott Hanselman
points out that there is a move afoot to take over maintenance of the BrowserCaps.ini file over at
Code Project.
This is a good move since Microsoft doesn't update this, but it totally
affects the way ASP.NET renders HTML. If you aren't familiar with the
BrowserCaps configuration, it basically looks at the user's browser and
determines what capabilities and features it has, for instance frames
or javascript or CSS version.
On more than one occasion I've run into code that looks like this:
<table><tr><asp:Panel id="panHideTD" runat="server"><td>Some stuff here
</td></asp:Panel><td>Some other stuff here</td></tr></table>
The
intention is to hide the table cell in certain situations; the problem
is the default ASP.NET configuration outputs a panel as a table in
Firefox and as a div in IE. So you end up with really bad table
formatting.
While I'm not going to get into own feelings on this type of formatting
technique, I will say that having an up-to-date BrowserCaps section in
machine.config can fix this and a variety of other issues. Or at least
make things render more consistently and treat Firefox/Safari/Opera/etc
as browsers on the same level as IE. In addition, newer versions of
browsers are not fully understood either unless the BrowserCaps.ini is
updated. For instance, your web app won't know anything about the
capabilities of IE7 when it is released unless you update the
BrowserCaps section.
Dev teams may be hesitant to do this since it can totally affect
cross-platform rendering and you definitely have to regression test
existing code and layouts to make sure you don't break something. So
it's not something you necessarily want to update all the time. The
good news is you can change all your web apps by changing the
machine.config, but you can also do it at the web application level by
making changes in web.config as well. It works like any other
configuration section in .NET, so you can make changes at multiple
levels and it will apply the most specific set. It's definitely
something worth considering though since it can make cross-platform
capability a bit easier and allow your apps to take better advantage of
browser capabilities, depending on what you are doing. I haven't
researched yet whether there is an updated BrowserCaps section for
ASP.NET 2.0, but I would suspect there will be.