Mortgages - Loans - Credit Cards - Car Accident Lawyer Los Angeles - Loans

PDA

View Full Version : any If statements to check browsers?


gilgalbiblewheel
Jul 31st 2007, 11:34 am
Is there any If statement to check browsers?

I want to check IE6, IE7 and Firefox.

dizzy
Jul 31st 2007, 2:24 pm
Check the Request.ServerVariables("HTTP_USER_AGENT")

For IE, the string will contain 'Mozilla'
For Firefox, the string will contain 'Gecko' or 'Firefox'

ccoonen
Aug 2nd 2007, 9:45 pm
If its a non-server side issue, IE has things called conditional comments... which allow you to do X if IE 6 or IE55 or Less Than IE5 or whatever... Essentially it's comments to the rest of the world, but IE sees them as a psuedo programming block so you can define elements in IE to be Not Commented if certain criteria are met :)

KowDot
Aug 17th 2007, 9:08 pm
Something like
[asp.net]
If Request.Browser.Browser.ToLower.Contains("firefox") Then
[javascript]
if (navigator.userAgent.indexOf("Firefox")!=-1)