Site compatibility: Accidental discrimination, and getting a free ride
Thursday, 3. January 2008, 15:28:42
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.
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 fitness-superstore.co.uk 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){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('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.


manywhere # 3. January 2008, 19:51
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): http://my.opera.com/community/forums/topic.dml?id=200882
Anonymous # 4. January 2008, 02:38
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
Anonymous # 4. January 2008, 06:26
I checked for Safari (ver 3.0.4 523.12.9). Even it returns 'Netscape'.
haavard # 4. January 2008, 08:06
suribe # 5. January 2008, 01:27
try the full screen button at the bottom of the presentation
haavard # 5. January 2008, 09:40
Anonymous # 26. January 2008, 18:51
Nothing strange :-)
After russians purchased LiveJournal.com it no more works with Opera too - and reasons seem to be new CSS and JS :-)
aietkolkhi # 31. December 2008, 07:50
which 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?