0

I'm using node.js + angularJS 1.5.7

when I use popup when External Authification or Purchase

ex> mysite => popup open(A) => Auth (like google) => post(A) => window.opener.postMessage

Script like this.

        /* request code */
        var child = null;
        child = window.open('', pop_title, opt);
        child.location = url;
        child.focus();
        var frmData = document.payForm;
        frmData.target = pop_title;
        frmData.action = url;
        frmData.submit();

        var leftDomain = false;
        var interval = setInterval(function () {
            try {
                if (child.document.domain === document.domain) {
                    if (leftDomain && child.document.readyState === "complete") {
                        clearInterval(interval);
                        child.postMessage({message: "requestResult"}, "*");
                    }
                } else {
                    leftDomain = true;
                }
            } catch (e) {
                // we're here when the child window has been navigated away or closed
                if (child.closed) {
                    clearInterval(interval);
                    return;
                }
                // navigated to another domain
                leftDomain = true;
            }
        }, 500);

        /* child page */
        document.domain = "mysite.com"
        targetWindow = window.opener;
        targetWindow.postMessage({ message: "deliverResult", result: "succ" , msg: "¿¿¿ ¿¿ ¿¿¿ ¿¿¿¿¿¿¿.", tid: "<?=$_POST["Tradeid"]?>"}, "*");

this code works in Edge or Chrome. But IE11 doesn't work.

I tried Another way

        localStorage.setItem("orgWindow",window);
        localStorage.getItem("orgWindow");

But this not working too. Window is Found. But Opener is null.

I use IFrame when IE11 temporary. But I want Popup All browser.

Please give me any idea please.

Thanks.

sunny K
  • 1
  • 1

1 Answers1

0

If you check the documentation for Window.Opener than you will notice that compatibility for IE is unknown.

Reference: Window.opener

It can be the possible reason that why it is not working as expected in IE. You can try to use alternative approach like in the link below.

window.opener alternatives

Deepak-MSFT
  • 10,379
  • 1
  • 12
  • 19