Site compatibility: Accidental discrimination, and getting a free ride

I have previously covered the issue of site compatibility in Opera, and how there are several reasons why a site might fail. One of the main problems I come across when looking into bug reports dealing with site compatibility is sites that break in Opera due to browser sniffing. Either the designer has a script which singles out Opera and sends it broken code, or he assumes that only one or two browsers exist while other browsers are simply ignored and never even given anything useful to work with.

Today, I took care of a bug report I had to hand over to our Open the Web team because it used browser sniffing and assumed that there are only two browsers in the whole world – IE and Netscape. I thought this might be a great time to highlight this issue, and show what kind of problems we are dealing with when looking into site compatibility. …

If you go to and click the image abov "Click image to enlarge", a popup is supposed to open. This does not happen in Opera, but it works fine in IE and Firefox.

But why?

If you open Opera's error console, you will notice the following error in the site's script:

name: ReferenceError
message: Statement on line 60: Undefined variable: imgWin

If we go back to find out how "imgWin" is set, we find this:

if (isNN){'about:blank','',optNN);}
if (isIE){'about:blank','',optIE);}

So we have isNN and isIE, which refer to Netscape Navigator and Internet Explorer respectively:

var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}

The site clearly assumes that IE and Netscape are the only browsers in the world. But it still works in Firefox, so what's going on?

It looks like Firefox's roots are still visible in navigator.appName: Paste "javascript:alert(navigator.appName);" into Firefox's address bar, and the JavaScript alert dialog will return "Netscape". Opera, on the other hand, reports itself as "Opera", and this tiny detail breaks the popup script.

One could say that Firefox is a "new version of Netscape". It comes from Netscape's code base, and initially used the "Netscape engine" (Gecko). Even before Firefox existed, many sites were updated to work with Netscape 6 because most Web developers knew about Netscape. Even today, it looks like most Web developers take Netscape into account when working on their sites.

So when Firefox was created it, in a way, got a "free ride" because of its Netscape roots and because it used the "Netscape engine".

I am not sure when we decided to return "Opera" for navigator.appName, but there has been discussion at Mozilla to do the same with Firefox. Considering Asa's cheering when we stopped spoofing as IE by default it is rather puzzling that they have not gotten around to accurately representing themselves yet πŸ™‚

In any case, I hope this can be useful to at least understand a small part of the compatibility issues alternative browsers face today: The quite common assumption that there are only two browsers out there.


8 thoughts on “Site compatibility: Accidental discrimination, and getting a free ride

  1. Well, that site isn't the only one just working in Netscape and IE. Swedes have had problems using the web-TV sites of the Swedish tabloids Aftonbladet and Expressen. I took a look at the Javascript that the sites used and discovered that one actively blocked Opera (I would like to know why) and another didn't just take into account Opera and other alternative browsers. The result: a page telling you to use IE or Firefox instead of any other browser. Not nice. :(For the Swedes wondering, here is a user javascript fix for the web TV sites, although it doesn't seem to work in the 9.5 beta just yet (I haven't had time to update it):

  2. Asa Dotzler writes:

    I think it's a bit misleading to suggest there's any serious problem with sites being developed today that sniff for IE and Netscape. Sites today are overwhelmingly sniffing for IE6 (and some IE7) and Firefox / Gecko. That is a problem, but at least they're forced by Firefox's market presence to write code that's a whole lot closer to working in Opera and Safari than if there was just an IE out there. – A

  3. You are probably right that most sites sniff for Gecko, Asa, but this used to be because most webmasters automatically supported Netscape 6 when it was released. This is what I meant by Firefox getting a "free ride" when it came to compatibility. But the fact is that many sites are still stuck in the days of two browsers – Netscape and IE.

  4. That one seems to be caught by the popup blocker. But a discussion about that site should probably be taken to the forum, not here.

  5. Anonymous writes:

    Nothing strange :-)After russians purchased it no more works with Opera too – and reasons seem to be new CSS and JS πŸ™‚

  6. I recently tried to subscribe to Washington Post, visiting yielded interesting result:"An important note about your system:The software you are using to browse the Web is not supported for this Web site. Please use the latest versions of either Safari or Firefox. Both are free."Any idea what 'supported for this Web site' means? πŸ™‚

Comments are closed.