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?
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?
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>") %>
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.
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?
Bookmarks