View Full Version : any If statements to check browsers?

07-31-2007, 07:33 PM
Is there any If statement to check browsers?

I want to check IE6, IE7 and Firefox.

08-01-2007, 12:25 AM
Using Request.ServerVariables("HTTP_User_Agent") will return the user agent (browser) string which you can parse to get the browser and version like so

Dim browser
browser = Request.ServerVariables("HTTP_User_Agent")
If InStr(browser, "MSIE 6") > 0 Then
'It is IE 6
ElseIf InStr(browser, "MSIE 7") > 0 Then
'It is IE 7
ElseIf InStr(browser, "Firefox") > 0 Then
'It is firefox
'it is some other browser
End If