NVidia: lost in their own sniffer

If a user identifies as Opera and loads the NZone page on


it is not possible to use the links "Demos", "Videos", "Screensavers", "Wallpapers" to see lists of download content.

The script detects browsers and sets a few variables – some for detection and some functional ones. One of the functional ones is called "layerRef" and is how the script remembers whether to use document.all (in IE4), document.layers (in Netscape 4) or document.getElementById – the standardised alternative supported by nearly all other modern browsers.

The following JavaScript does not work as expected:



else if (NS6 || NS7 || Mozilla)

eval(layerRef + "("listData").innerHTML = demoDataHTML;");


eval(layerRef + "["listData"].innerHTML = demoDataHTML;");

This is because "layerRef" has been set to document.getElementById but NS6, NS7 and Mozilla are all false when you identify as Opera.

Opera then tries to execute the final line which evaluates as:

document.getElementById["tableTitle"].innerHTML = newTitle;

Since that means they are calling a function with square brackets, the script fails.

Morale: if you mix two different types of sniffing: by browser name and by functionality – you risk getting lost in the messy branches of your script. Clean object detection is way better.


One thought on “NVidia: lost in their own sniffer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s