opener is undefined in popup

Confirmed Issue #11324352 • Assigned to Travis L.


David G.
Mar 19, 2017
This issue is public.
Found in
  • Microsoft Edge
Found in build #
Reported by 4 people

Sign in to watch or report this issue.

Steps to reproduce

From one window, open another window:

$('a#popup').on('click', function(event) {
    $this = $(this);
    authenticationWindow =$this.href, 'authenticationPopup');

In the first window, add an event listener for message event:

window.addEventListener('message', function (evt) {
    // simplified, should check for evt.origin, and check message to decide what to do

From the second window, perform a login on a different domain, which redirects back to a dummy page on the opener domain, which only posts a message to the opener window:

opener.postMessage('ok', window.location.protocol+'//';
// note, document.domain and opener.document.domain are the same, including protocol
// for old IE, after a timeout the window closes automatically

In this case opener was undefined (!). opener stays defined across navigation on every other browser, even IE(!), while in this case in Edge it becomes undefined.

For backwards compatibility with older IE, I made a check like if (window.addEventListener) to attach the message event listener, and added a timeout in case it’s not supported. I tried using this technique with Edge too: every second it check if (authenticationWindow.closed), but Edge always returns true even if the popup is still open!! So I found no workaround for this. Also, the popupWindow.closed always equals true sounds like another bug!!


0 attachments

    Comments and activity

    • Changed Title from “opener.postMessage does not work” to “opener is undefined in popup”

    • I just found out that it behaves correctly if the popup window always stays on the same protocol, if it switches from https to http, then opener gets unset.

      Is this a documented behaviour?

    • Microsoft Edge Team

      Changed Assigned To to “Steven K.”

    • Are you also planning to support rel="noopener" while fixing this bug ?

    • Microsoft Edge Team

      Changed Status to “Confirmed”

      Changed Assigned To to “Travis L.”

      Changed Title from “opener is undefined in popup” to “opener is undefined in popup”

    • Any update on this? Any plans to fix?

    You need to sign in to your Microsoft account to add a comment.

    Sign in