ASP.NET with FireFox – level 200

I’m a little slow on testing my ASP.NET apps with non-IE browsers, and it’s because I used to be in an environment where I was writing internal web applications, and IE 5+ was mandated.  That took away headaches, but now I need to have ASP.NET apps that look good and function well in all the major browsers, so right now, that includes FireFox.  Although IE still has an overwhelming market share, in my opinion, the Internet savvy are split more evenly in browser usage.  There are tons of computers that don’t get on the Net very often, and those all have IE, so I think it skews the numbers.

When testing my apps with FireFox, I noticed that ASP.NET was rendering for a down-level browser.  This is most likely because when .Net shipped, FireFox wasn’t a major player, but now it is, and it supports all the high-level features, so it’s necessary to add an entry to the <browserCaps/> section of the web.config.  Here is a page that can provide an applicable entry to make .Net render up-level to FireFox.

Some of the issues you will run into is that <div/> tags will be rendered as tables, and style percents will not be rendered at all.  It will dumb down the page to HTML 2.0.  Adding the <browserCaps/> section will cause the HTML rendered to be the same as that rendered to IE.  In IE, I use the style: TEXT-ALIGN:cetner to center contents of a div, but in FireFox, that doesn’t work (it may be a standard thing, I’m not too sure), but doing <div align=“center“/> fixed the problem in both browsers.

I’m also using the XHTML doctype.  If you search newgroups, you’ll find a lot of people poo-pooing xhtml as just a worthless fad, but if there is one and only one benefit (I’m sure there are more), it’s that my CSS is truly cascading.  In HTML 4.0, I have to redeclare classes because the settings don’t flow from the parent container to all children.  <td/> tags are notorious for this.