Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post

    any If statements to check browsers?

    Is there any If statement to check browsers?

    I want to check IE6, IE7 and Firefox.

  • #2
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,065
    Thanks
    4
    Thanked 8 Times in 8 Posts
    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


    Code:
    <%
    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
    Else
    	'it is some other browser
    End If
    %>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •