Skip navigation.

Head-smacking sniffing stupidity

, , ,

I'm feeling a bit like Hallvord right now :rolleyes:

While doing some web site troubleshooting, I bumped into the following code at Olive Software:
var Mac  =  (navigator.userAgent.indexOf("mac")!=-1)  || (navigator.userAgent.indexOf("Mac")!=-1);
var opnew = (navigator.userAgent.indexOf('Opera 7')!=-1);
var opold = (navigator.userAgent.indexOf('Opera')!=-1);
var msie  =  (navigator.userAgent.indexOf('MSIE')!=-1);
var moz  =  (navigator.userAgent.indexOf('Gecko')!=-1);
var NS6  =  (navigator.userAgent.indexOf('Netscape')!=-1 && navigator.userAgent.indexOf('Gecko')!=-1);
var Nav4  = (document.layers);
var konq = (navigator.userAgent.indexOf('Konqueror')!=-1);
if (opold && msie || opold){var opold=1; msie=0;}
if (msie && !opold){msie=1;}
if(opnew && opold){opold=0;}
if(msie || moz || opnew){var dom = 1;}

Whoever coded that was obviously having a really bad day. Maybe their cat had died, but it must have been something seriously distracting.

I mean, translate their "opnew" into English: "It's a new version of the Opera browser if it's version 7 and identifying itself as IE or Mozilla". That's right, any later versions (like 8 or 9) are old versions, and even version 7 identifying as itself is old!

And people wonder why Opera appears to have a hard time handling web sites?

CSS HackingOpera 9! Woot!

Write a comment

You must be logged in to write a comment. If you're not a registered member, please sign up.

Download Opera, the fastest and most secure browser
December 2009
S M T W T F S
November 2009January 2010
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31