Stinkbug
Feb 2nd, 2002, 01:28 PM
I am working on a tracking system and am having a little trouble getting the users Browser version and the OS name and version.
I have tried via JavaScript and ASP and both ways have flaws.
In JavaScript I tried:
an=navigator.appName;
av=navigator.appversion;
at=navigator.useragent;
an will return Netscape or Microsoft Internet Explorer (dont care about others yet) but av and at will only return "Undefined"... and untill I can get something other than what I am getting I cant find out how to get the OS.
In ASP I tried:
if instr(request.servervariables("HTTP_USER_AGENT"), "MSIE") then
tempArr = split(request.servervariables("HTTP_USER_AGENT"), ";", -1,1)
response.write "browser: " & temparr(1) & "<BR>"
response.write "os: " & temparr(2) & "<BR>"
elseif instr(request.servervariables("HTTP_USER_AGENT"), "4.78") then
tempArr = split(request.servervariables("HTTP_USER_AGENT"), ";", -1,1)
response.write "browser: Netscape<BR>"
tempArr = split(request.servervariables("HTTP_USER_AGENT"), "(", -1,1)
tempArr2 = split(temparr(1), ";", -1,1)
response.write "os: " & temparr2(0) & "<BR>"
end if
That will work as far as getting the IE browser & version easy but NS is alot more work (as with everything else to do with netscrap) but the getting the os is more tricky cos WinME will show as Win98 but has an extra string... and while I could all tons of code to pick out all these things I am thinking there must be a cut and dry way to do this... or someone has done it before and there is code posted somewhere... I mean, why try to reinvent the wheel when there are porches already on the road?
thanks in advance,
Michael
I have tried via JavaScript and ASP and both ways have flaws.
In JavaScript I tried:
an=navigator.appName;
av=navigator.appversion;
at=navigator.useragent;
an will return Netscape or Microsoft Internet Explorer (dont care about others yet) but av and at will only return "Undefined"... and untill I can get something other than what I am getting I cant find out how to get the OS.
In ASP I tried:
if instr(request.servervariables("HTTP_USER_AGENT"), "MSIE") then
tempArr = split(request.servervariables("HTTP_USER_AGENT"), ";", -1,1)
response.write "browser: " & temparr(1) & "<BR>"
response.write "os: " & temparr(2) & "<BR>"
elseif instr(request.servervariables("HTTP_USER_AGENT"), "4.78") then
tempArr = split(request.servervariables("HTTP_USER_AGENT"), ";", -1,1)
response.write "browser: Netscape<BR>"
tempArr = split(request.servervariables("HTTP_USER_AGENT"), "(", -1,1)
tempArr2 = split(temparr(1), ";", -1,1)
response.write "os: " & temparr2(0) & "<BR>"
end if
That will work as far as getting the IE browser & version easy but NS is alot more work (as with everything else to do with netscrap) but the getting the os is more tricky cos WinME will show as Win98 but has an extra string... and while I could all tons of code to pick out all these things I am thinking there must be a cut and dry way to do this... or someone has done it before and there is code posted somewhere... I mean, why try to reinvent the wheel when there are porches already on the road?
thanks in advance,
Michael