Click to See Complete Forum and Search --> : Browser Info


sniper
11-17-2005, 11:51 AM
I have to eliminate all javascript and replace it with asp. I've come across some code that checks the browser and version and can't remember the asp equivalent, nor can I find the code I had from school in my notebook. Here's the code I have to convert:

if (parseFloat(navigator.appVersion.substring(0,1)) < 4) then
response.redirect("BrowserError.asp?Lang="+request.QueryString("Lang"))
else
if(navigator.appName ="Netscape")then
if(parseFloat(navigator.appVersion.substring(0,4)) < 4.06)then
response.redirect("BrowserError.asp?Lang="+request.QueryString("Lang"))
end if
end if
end if

Thank you.

Giskard
11-17-2005, 12:32 PM
You want to check the Request.ServerVariables("HTTP_USER_AGENT") variable. You can do a google search for the possible values.

sniper
11-17-2005, 01:31 PM
Ok. I've been looking at code to see the values and am getting confused. Can you give me an example of how I would use it to check the browser application and it's version?
Thank you!

sniper
11-17-2005, 03:04 PM
OK. I think I have it, but it doesn't work. So maybe I don't have it. This is what I tried:

dim app_version
app_version= cint(mid(request.servervariables("HTTP_USER_AGENT"),9,1))
Cstr(instr(app_version,"N"))

What I am trying to do is see if the browser is netscap navigator and if it is of a certain version or above. i know how to get the application out, but can't seem to figure out how to get the version out. The code above is my failed attempt.
Thank you for any help.

Giskard
11-17-2005, 04:06 PM
This page has what you're looking for:

http://www.idowebs.biz/scripts/freestuff/asp_browser_detect.asp?m=3&s=11

sniper
11-18-2005, 07:53 AM
Thank you.