Forum Moderators: open

Message Too Old, No Replies

browser agent detection

         

laura2k

12:24 pm on Feb 11, 2004 (gmt 0)



hi,

at the moment i am using a javascript to detect whether my visitors browser is below version 5 of netscape if it is then i display something else. the javascript i am using is:

<SCRIPT LANGUAGE="JavaScript">
Netscape = navigator.appName == "Netscape";
if(Netscape) {
NetscapeVer = parseFloat(navigator.appVersion);
if(NetscapeVer < 5) document.write('Netscape4');
}
</SCRIPT>

i've been told that this can be done in asp by detecting the user agent and the version, can anyone tell me how i can do this?

thanx in advance

webdevjim

5:24 pm on Feb 11, 2004 (gmt 0)

10+ Year Member



Here it is

<%
If InStr(Request.ServerVariables("HTTP_USER_AGENT"),"MSIE") Then
Response.Write("Your browser is Internet Explorer!")
Else If InStr(Request.ServerVariables("HTTP_USER_AGENT"),"Mozilla") Then
Response.Write("Your browser is Netscape!")
Else
Response.Write("Your browser is other than Internet Explorer and Netscape.")
End If
End If
%>

/WebDevJim