Note that there are some explanatory texts on larger screens.

plurals
  1. POIE - Access denied to window opened through javascript
    primarykey
    data
    text
    <p>I'm opening a new window through javascript with user specific information that needs to be closed when the user is changed in the parent window.</p> <p>I save the child window reference so that I can close it later. The code looks something like this,</p> <pre><code>if (globals.newWindow) { globals.newWindow.focus(); } else { var url = $link.attr("href"); globals.newWindow = window.open(url, "windowName"); } </code></pre> <p>Later, to close the child window I do this,</p> <pre><code>if (globals.newWindow) { globals.newWindow.close(); globals.newWindow = null; } </code></pre> <p>This works fine in FireFox and Google Chrome. However, in Internet Explorer I get "Access denied" when I wish to close the window.</p> <p>Why is that?</p> <p><strong>update:</strong></p> <p>Closing the parent window and opening it again, then clicking the function to open the new window will refresh the still open child window. After that, clickgin the close function will close the child window.</p> <p><strong>update 2:</strong></p> <p>Another thing I'm seeing while debugging this is that when access is denied, the window is also already considered closed (its closed property is true). That could be why it doesn't get closed?</p> <p><strong>update 3:</strong></p> <p>The difference between FireFox and IE is that when closing in FireFox, window.closed == false (which makes sense since it's not closed yet) while in IE window.closed == true. IE believes the window to already be closed before I run window.close();</p> <p>The reason for this is for me a total mystery.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload