Last modified: 2010-06-23 17:53:02 UTC
http://upload.wikimedia.org/centralnotice/commons/en/centralnotice.js?283g is broken on IE6 because it uses a call DBsWithVector.indexOf() where var DBsWithVector = [ /* An array of strings */ ]; Array.prototype.indexOf doesn't exist on IE6 (and apparently also IE7, if I'm to believe web resources). The error message in IE6 says that "object does not support this method"--if only they had told me which object and which method, I wouldn't have had to search for some hours! IE apparently does have an Array.indexOf "static" method, see http://msdn.microsoft.com/en-us/library/bb383831.aspx but that method is *not* on the prototype! I do not know whether this Array.indexOf static method is indeed available on IE6. Note that the DBsWithVector thing is inside the string wgNotice! Proposed fix: There's two ways to fix this. Simple fix first: replace DBsWithVector.indexOf( wgDBname )!= -1 by (' ' + DBsWithVector.join (' ') + ' ').indexOf (' ' + wgDBname + ' ') != -1 IE6 does have Array.prototype.join, and it does have String.protype.indexOf, so this will work. More proper fix: since DBsWithVector is used only for this test, change the array into an object: var DBsWithVector = {'enwiki':1, 'commonswiki':1, /* and so on, no comma after the last one! */ }; Then test using simply DBsWithVector[wgDBname] No need for indexOf at all. Both proposed fixes should work on all browsers. Marked "major" since this affects all skins and makes visiting Wikipedia for logged-in users with IE6 next to impossible. Luckily anons are unaffected by the bug, because the full test is if ( wgUserName == null || DBsWithVector.indexOf( wgDBname )!= -1 ) ...
If i recall, Array.indexOf() is non-standard, and also not in opera.
Array.indexOf() is in JavaScript 1.6 ([[JavaScript#Versions]]).
Fixed with a ridiculously long OR statement
Is this some Wikimedia stuff? Changing product and component.