Javascript SymWinOpen function pain

This one really bugged me. I was trying to validate some code I had uploaded to a staging area on a site and it would not validate back on my PC running CSE HTML Validate because something somewhere was inserting extra bits of javascript, SymWinOpen, and I could not work out what was happening. I was getting the same added script in Firefox, IE and CSE HTML Validator (and this extra code was stopping my pages from validating) until I opened the same page up in Safari on my Mac and it didn't have the extra code...

I eventually found that it was Norton Anti Virus 'adjusting' the pages for me as they came in on my PC. I probably should be grateful that its doing its job but you can turn it off:

This is the code:

function SymError()
{
return true;
}

window.onerror = SymError;

var SymRealWinOpen = window.open;

function SymWinOpen(url, name, attributes)
{
return (new Object());
}

window.open = SymWinOpen;

//

followed by:

var SymRealOnLoad;
var SymRealOnUnload;

function SymOnUnload()
{
window.open = SymWinOpen;
if(SymRealOnUnload != null)
SymRealOnUnload();
}

function SymOnLoad()
{
if(SymRealOnLoad != null)
SymRealOnLoad();
window.open = SymRealWinOpen;
SymRealOnUnload = window.onunload;
window.onunload = SymOnUnload;
}

SymRealOnLoad = window.onload;
window.onload = SymOnLoad;

//

Hopefully this will prevent hair loss as people try to figure out where this extra code is coming from!

Update!

Just discovered that the link I had to the Symantec page with information no longer resolves.

By Simon Cox | Published: Fri, Dec 23, 2005 Shorticles | Web

Next short: Scaloox water tower

Previous short: Loxley Barton Falls - Picture in Railway Modeller

Latest Shorticles

Or all the short articles

Latest Articles

Or all the articles