Problems using window.opener in all browsers

Well, I have serious problems. On my own computer, this code works fine. But with my colleagues, it breaks down in IE and Firefox.

var openlocation = window.opener.location.href;

breaks for the "Failure Resolution", on the window.opener part. So, on an open page, I wrote a function that is stored on an external .js page:

var getLocation = function() {
    return window.location.href;
};

and then calling it like var openlocation = window.opener.getLocation();

Does anyone know why this breaks?

Edit: one page creates a popup, and they are both in the same domain. The popup page has the following code:


$(document).ready(function () {
    var openlocation = window.opener.getLocation();
    (function setTimer() {
        setInterval(function () {
            if (window.opener.location.href != openlocation) {    // they've changed screens
                window.close();
            }
        }, 15000);
    })();
  $("input#notescancel").click(function () {
        window.close();
  });
});

I tried both with my function getLocation()and with help window.opener.location.href, but for all computers except mine, it breaks. Thank.

+3
source share
2 answers

. window.opener.location - IE , . , , .

, window.opener.location.href, window.opener.location.toString() IE.

+1
+1

All Articles