Skip navigation.

exploreopera

| Help

Sign up | Help

In what browser can you enumerate navigator.plugins?

, , ,

I noticed an advertising script using for..in on navigator.plugins. The way that is written causes errors both in Opera and FireFox, so my question of the day is: what browser did they test in? That code can't be targeted at IE, because it has no real support for navigator.plugins.

If you have a Safari, Konqueror, Mozilla or any 4+ version of Netscape handy, can you tell me what the following bookmarklet says?


javascript:try{for(i in navigator.plugins)navigator.plugins[ i ].description.indexOf('a');alert('Browser passed test');}catch(e){alert('Browser failed test. No description for "'+i+'", but enumerated')}


Thanks!

Cross-browser compatibility matters!Microsoft's vista of tag soup

Comments

avatar
Maybe it's just a joke to see if we are paying attention?
It did absolutely nothing in Netscape 4.74 and 6.2.
I'm sorry to admit that my preferite browser, Mozilla 1.7.11, has not passed the test (whatever it is). Literally: 'Browser failed test. No description for "lenght", but enumerated'. The Javascript Console shows a warning: reference to undefined property navigator.plugins.description.
Same fail for 'lenght' in Netscape 7.01, but no javascript warning.

By eben2, # 15. September 2005, 00:11:35

avatar
Oops, some filtering on the server ate a couple of characters. The property in the javascript warning is document.plugins(left square bracket here)i(right square bracket here).description!

By eben2, # 15. September 2005, 00:15:28

avatar
Safari says 'Browser passed test'. Konqueror (v3.3.1) says 'Browser failed test. No description for "namedItem", but enumerated'.

I guess an advertising agency using Macs isn't much of a surprise...

By Andrew Gregory, # 15. September 2005, 03:31:54

avatar
Seems Netscape 4 doesn't support try..catch in bookmarklets. Anyway, it actually passes the test if rewritten! I guess Andrew is right that this probably was written on a Mac and tested in Safari :smile:

I'm also surprised to learn that Mozilla 1.7.11 actually writes error messages to the JS console even for code inside try..catch! I can see that it can be useful for developers to do so, but it still seems like very unexpected behaviour.

Time to go contemplate PPK's gems in the first inline script of http://www.quirksmode.org/logo.html again.. :-)

By hallvors, # 15. September 2005, 08:37:11

avatar
Same fail for 'lenght' in Netscape 7.01, but no javascript warning.

By qicaispace, # 29. May 2006, 03:33:55

Write a comment

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