Site compatibility: Accidental discrimination, and getting a free ride
Thursday, January 3, 2008 3:28:42 PM
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.


Filipmanywhere # Thursday, January 3, 2008 7:51:00 PM
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 # Friday, January 4, 2008 2:38:59 AM
Anonymous # Friday, January 4, 2008 6:26:47 AM
Haavardhaavard # Friday, January 4, 2008 8:06:33 AM
Sergio Uribesuribe # Saturday, January 5, 2008 1:27:37 AM
try the full screen button at the bottom of the presentation
Haavardhaavard # Saturday, January 5, 2008 9:40:34 AM
Anonymous # Saturday, January 26, 2008 6:51:18 PM
Aiet Kolkhiaietkolkhi # Wednesday, December 31, 2008 7:50:13 AM
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?