In what browser can you enumerate navigator.plugins?

I noticed an advertising script using 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')}



5 thoughts on “In what browser can you enumerate navigator.plugins?

  1. 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!

  2. 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.

  3. 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…

  4. 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 :)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 again.. 🙂

Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s