Results 1 to 4 of 4

Thread: Check browser with ASP check

  1. #1
    Join Date
    Jan 2009
    Posts
    13

    Check browser with ASP check

    Hey.
    I know that you can check the browser with javascript. But anyone know if there is any way to the normal asp check if it is Internet Explorer or FireFox or something else?

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Check browser with ASP check

    Nothing super smooth and quite reliably, but you can use Request.ServerVariables ("HTTP_USER_AGENT")

    Type:
    <% strAgent=Request.ServerVariables("HTTP_USER_AGENT") Response.Write "<p>"&strAgent&"</p>" '=== BROWSERS ua_IE="MSIE " If InStr(strAgent,ua_IE) <> 0 Then strBrowser = "Internet Explorer" strVersion = Mid(strAgent, Instr(strAgent,ua_IE)+Len(ua_IE),3) End If ua_FF="Firefox/" If InStr(strAgent,ua_FF) <> 0 Then strBrowser = Replace(ua_FF,"/","") strVersion = Mid(strAgent, Instr(strAgent,ua_FF)+Len(ua_FF)) End If ua_OP="Opera/" If InStr(strAgent,ua_OP) <> 0 Then strBrowser = Replace(ua_OP,"/","") strVersion = Mid(strAgent, Instr(strAgent,ua_OP)+Len(ua_OP),4) End If '=== SPIDERS ua_GO="Googlebot/" If InStr(strAgent,ua_GO) <> 0 Then strBrowser = Replace(ua_GO,"/","") strVersion = Mid(strAgent, Instr(strAgent,ua_GO)+Len(ua_GO),3) End If ua_MS="msnbot/" If InStr(strAgent,ua_MS) <> 0 Then strBrowser = "MSN Bot" strVersion = Mid(strAgent, Instr(strAgent,ua_MS)+Len(ua_MS),3) End If '=== Unknown/Other IF strBrowser="" THEN strBrowser = "Unknown/Other" strVersion = "Unknown/Other" END IF Response.Write("<p>Browser: " & strBrowser & "<br>Version: " & strVersion & "</p>") %>

  3. #3
    Join Date
    Jan 2009
    Posts
    13

    Re: Check browser with ASP check

    Thank you for taking the time.
    I actually solved the problem myself with the same approach.
    Actually, so I just wanted to see if it was IE or something else and then I look for the phrase "MSIE". And it seems of course work.
    The reason was that IE supports the one thing that I use (<select> inside a <div>), while FF does not support this.
    I use this to make nice select boxes without frames. In IE, it will be super nice, while it completely balls out of the FF. Then see them old select boxes with frames instead.

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    Re: Check browser with ASP check

    Ok, so good then.

    Out of curiosity: How do you mean that the FF does not support this?
    Do you have a page you can look at or sample code that shows this phenomenon?

Similar Threads

  1. How to check correct browser setting for Internet Explorer
    By Gunwant in forum Windows Software
    Replies: 6
    Last Post: 29-01-2010, 07:35 PM
  2. How to Check the Registry
    By Angel SAM in forum Operating Systems
    Replies: 3
    Last Post: 20-08-2009, 03:24 PM
  3. How to check for prototype browser compatibility
    By Abraham.J in forum Software Development
    Replies: 3
    Last Post: 18-08-2009, 03:18 PM
  4. How to Check Your RAM?
    By Aapti in forum Motherboard Processor & RAM
    Replies: 5
    Last Post: 11-02-2009, 12:04 PM
  5. How to check is the OS is 64 bit or 32 bit?
    By Gugle in forum Windows Server Help
    Replies: 4
    Last Post: 14-01-2009, 02:30 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,931,975.39084 seconds with 16 queries