how to shoot yourself in the menu with a variable
Thursday, 6. April 2006, 18:47:22
One of the interesting challenges of doing that is to work out how, exactly, browser.js can tell when Opera is about to run an "outdated" script that needs fixing? Because if we apply the fix to a modern script, we might break things instead of fixing them..
Until today I thought the AllWebMenus fix was one of the safest in the book. It takes advantage of the fact that every AWM script contains a "build number" variable showing what version the script is. This variable is not even part of the comments where webmasters might remove it, it is right there embedded in the script. It is also relatively unlikely (though not impossible) that other scripts would define a variable called awmBN with a value that would trigger the patch, and even more unlikely that the patch would break a script doing so.
OK, think again. Browser.js breaks the menu on Aquaria.info because the inline script says
var MenuLinkedBy='AllWebMenus [2]', awmBN='438';
while the script file the page links to actually reveals a much more recent build number:
//****** AllWebMenus Libraries Version # 626 ******
So the webmaster has changed the .js files to upgrade, but not bothered changing the script in the HTML file. Not such a safe patch after all..
Once I stop saying "d'oh" I'll have to figure out what to do about it.. :-(








