This is a very simple Browser Compatibily Script using ASP to help you with basic cross-platform issues.
So what I was looking for is very simple. I have a page which uses CSS to display a New Products Bar on a website. I was using CSS along with JQuery and when all was said and done, in IE everything was working perfectly. However, as most developers know, one of the most common issues with different browsers is how they handle CSS. When I checked the same page in FireFox, my text, which was supposed to be in the middle of the screen, was showing up at the top left of the site (position:absolute). Therefore, instead of re-coding the whole page and figuring out how to make JQuery and CSS play nice with all browsers, I decided to simply implement a very basic browser-compatibility script to get around the problem.
<%
dim currentBrowser, browserHeight
currentbrowser = Request.ServerVariables("HTTP_USER_AGENT")
If InStr(1, Request.ServerVariables("HTTP_USER_AGENT"), "MSIE") then
browserHeight = "0"
Else
browserHeight = "-12"
End If
%>
Basically, I am checking to see if the browser that is calling this page is IE or not. If it is IE I am setting the browserHeight=0 and if it is any other browser then I am setting the browserHeight=”-12″.
browerHeight is serving as my top: value in CSS.
That’s it. Without spending too much time I solved my problem with this simple block of code. Of course, this is not meant for everyone, but it is a very useful script for anyone who needs a quick fix with browser-compatibility issues.
thanks man. this is exaclty what I was looking for. something simple to help me with the firefox/ie problem on my login page.