ASP‎ > ‎

ASP Code to detect browser type

The following ASP code seems to properly detect browser type:
 
 
<%
Dim myUA   
myUA = Request.ServerVariables("HTTP_USER_AGENT")
Dim strBrowser
If instr(myUA, "MSIE") then
 strBrowser= "Internet Explorer"
Elseif instr(myUA, "Firefox") then
 strBrowser= "Firefox"
Elseif instr(myUA, "Chrome") then
 strBrowser= "Chrome"
Else
 strBrowser = "Unknown"
End if
%>
 
 
 
Comments