Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q358 Why when writing into a popup window does Internet Explorer return with 'Access is denied'?

You are here: irt.org | FAQ | JavaScript | Window | Q358 [ previous next ]

Its because Internet Explorer 4 does not wait for the window to open before continuing with the attempt to write into the as yet unopened window, whereas Netscape waits for the creation of the window to complete before carrying on with the execution of the rest of the code.

You could get around this by setting a timer so that you delay the update of the newly opened window for say 1 or 2 seconds, or you could get the newly opened windows onLoad event handler to request that the opener window updates the contents of the popup window:

<SCRIPT LANGUAGE="JavaScript"><!--
var windowHandler = '';

function setup() {
    windowHandler = window.open('blank.htm','windowName');
    if (!windowHandler.opener) windowHandler.opener = self;
}

function update() {
    windowHandler.document.open();
    windowHandler.document.write('<HTML><HEAD><TITLE>Hello World<\/TITLE><\/HEAD>');
    windowHandler.document.write('<BODY>');
    windowHandler.document.write('<H1>Hello World<\/H1>');
    windowHandler.document.write('<\/BODY>');
    windowHandler.document.write('<\/HTML>');
}

setup();
//--></SCRIPT>

And then in blank.htm:

<BODY onLoad="opener.update()"></BODY>

Feedback on 'Q358 Why when writing into a popup window does Internet Explorer return with 'Access is denied'?'

©2018 Martin Webb