Jump to content

Browser Type

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
Chan

Chan

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 204 posts
Using JavaScript is there a way to determine what browser type the user is using?

I need to compile some data and would like to collect this in a file.

#2
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Here try using this code:

<html>

<body>
<script type="text/javascript">
var browser=navigator.appName
var b_version=navigator.appVersion
var version=parseFloat(b_version)

document.write("Browser name: "+ browser)
document.write("<br />")
document.write("Browser version: "+ version)
</script>
</body>

</html>

But, I don't know why, it detect my Firefox as Netscape 5 :S perhaps because I had Netscape installed? I don't know! Anyways, If you want something more powerful and perhaps more accurate try using PHP...

#3
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts

TheComputerMaster said:

But, I don't know why, it detect my Firefox as Netscape 5 :S perhaps because I had Netscape installed? I don't know!
Firefox was a fork of Netscape browsers, so that's probably why you see Netscape as browser-name. The version number five is a bit strange, but to be honest I think they've forgotten to update it. And also have Internet Explorer. The only browser I tried, that shows everything correctly is Opera. This is just mine little thesis.

I made a little test using your code:
"Real" name:		"False" name:		"Real" version:		"False" version:
----------------------------------------------------------------------------------------
FireFox			Netscape		2.0.0.3			5
Internet Explorer	Internet Explorer	7.0.5730.11		4
Netscape browser	Netscape		8.1.2			5
Opera			Opera			9.02			9.02


#4
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Yes I agree with Firefox and Internet Explorer ones, I didn't Try it on Netscape, coz I just used that for a few days, I didn't like it and as far as I know and tested it, Opera is alright :)