Supporting FireFox in ASP.Net

Browser compatibility is a huge issue for commercial websites, but for a personal website like this, it really is not all that critical. In fact, when I designed this website, the main goal was to build a website that supports dynamic contents well (easy to add new stuff and easy to maintain), and did not even think about supporting browsers other than IE.

Soon after I launched the website however, I had to change how my code handles dynamically generated navigation in the media section to get the links to images and videos look correctly in FireFox. Because the left side nav-bars on my website are ASP.Net Panel controls, and for some reason the dynamically added LinkButtons do not have line breaks when rendered in FireFox, and all the links became a single line. This was more than a cosmetic problem, so I had to add line breaks in the code to get the page to work correctly in FireFox.

That was not my only problem with FireFox though. All the panels are rendered as tables in FireFox whereas they are rendered as div’s in IE. The problem for this was pretty noticeable: In FireFox, all the contents would appear to be centered vertically on screen (when there’s not much content, the layout looks pretty ugly). This issue bugged me somewhat, but since it does not affect a user to navigate through the website, I never attempted to fix it.

Recently, after launching my blogs, I found another issue with how ASP.Net controls were rendered by FireFox. The Calendar control would be truncated in FireFox when used in panels. And it looks quite ugly.

So, after these experiences, I finally decided to add some support to browsers other than IE. The solution, to my surprise is actually quite simple.

Bart Gerardi has a wonderful article explaining what are the incompatibilities you can expect when building a website using ASP.Net (1.1) (see Rendering to FireFox from ASP.NET). Basically, the solution is to change your web.config file. Another article by Mitch Rupp (see ASP.NET Web Controls and BrowserCaps) gives similar solutions.

I decided to keep my browser compatibility warnings on for non-IE browsers though, even though the above methods make FireFox render ASP.Net controls correctly, some aspects (e.g. the width of the control when using percentage instead of points) still have minor issues. And the font size rendered in FireFox seems to be a size smaller than rendered in IE.

Hopefully, the ASP.Net 2.0 will achieve better cross browser compatibilities so that developers would worry less when deploying ASP.Net web applications.

Be Sociable, Share!

Leave a Reply