Closed Bug 229761 Opened 21 years ago Closed 21 years ago

inaccurate results of browser sniffer

Categories

(SeaMonkey :: General, defect)

x86
Windows 98
defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 61071

People

(Reporter: ajpuiras, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.6b) Gecko/20031208
Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.6b) Gecko/20031208

I just designed a browser sniffer that works in Internet Explorer and Netscape
Navigator, but when I tested it in Mozilla, it returned Netscape Navigator. Why
is this? Try using the following code in the Mozilla browser:

<html>
<head>
<title>Browser Sniffer</title>
</head>
<body>

<script>

function detectBrowser() {

// default in case not listed

var browser ="an unknown browser."

if (navigator.appName.match('Microsoft Internet Explorer')) { var browser =
"Internet Explorer" }

if (navigator.appName.match('Netscape')) { var browser = "Netscape Navigator" }

if (navigator.appName.match('Opera')) { var browser = "Opera" }

if (navigator.appName.match('Mozilla')) { var browser = "Mozilla" }

alert('You appear to be using '+browser+'.\n\nPlease note, that for reasons
unknown to me, Opera returns Internet Explorer and Mozilla returns Netscape
Navigator, so I cannot guarantee that the results of this are 100% accurate.') }

</script>

<a href="javascript:detectBrowser()">What browser am I using?</a>

</body>
</html>

Reproducible: Didn't try

Steps to Reproduce:



Expected Results:  
It should have returned "Mozilla" instead of "Netscape Navigator".

*** This bug has been marked as a duplicate of 61071 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.