Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 14-01-2009
Member
 
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?
Reply With Quote
  #2  
Old 14-01-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: Check browser with ASP check

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

Type:
Quote:
<% 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>") %>
Reply With Quote
  #3  
Old 14-01-2009
Member
 
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.
Reply With Quote
  #4  
Old 14-01-2009
Member
 
Join Date: May 2008
Posts: 2,293
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?
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 08:10 PM.