JavaScript, .closed and Windows Update KB918899
I maintain a slightly aging Intranet application and came across a JavaScript “Permission Denied” error on a page handling pop-up windows. I know pop-up windows aren’t very Web 2.0 but you can save your evangelism for another day. In defense of all things flashy and new, the app is slowing migrating to AJAX. Very slowly.
Anyway, after some light searching I came across a thread at thescripts that goes into some detail on the problem before digressing into a programmer slapfight.
Let me try and save you the trouble of wading through that mess…
A Windows XP Update (KB918899) has taken the window.closed property and totally screwed it in Internet Explorer.
Before, this would work:
if (openWin.closed)
{
// blah blah blah
}
After the XP Update, that call to openWin.closed causes the “Permission Denied” error to occur. The best guess I’ve seen for the reason why is a hold IE is putting on the state of the window. The thread suggests setting the call to .closed on some kind of delay, with SetTimeOut I assume, but that didn’t seem to work for me.
Another suggestion was to try this:
if (typeof(openWin.closed) != 'unknown')
{
// blah blah blah
}
Using that if statement got me results about half of the time, but half of the time is just as bad as a generic “Permission Denied” error as far as I’m concerned.
I threw together a temporary hack solution involving a global variable and onFocus() to get what I wanted inside that if statement done. If someone comes across a legitimate fix for what KB918899 has broken let me know.










No Comments
Leave a comment...