Okay, I’m having serious problems here. On my own computer, this code works just fine. But on my coworkers, it breaks in IE and Firefox.
var openlocation = window.opener.location.href;
breaks for “Permission Denied”, on the window.opener part. So, on the opener page, I wrote a function that’s stored in an external .js page:
var getLocation = function() {
return window.location.href;
};
and then calling that, like
var openlocation = window.opener.getLocation();
Does anyone have any idea why this is breaking?
Edit: One page is creating the popup, and they’re both on 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’ve tried with both my getLocation() function and just using window.opener.location.href but, for all computers but mine, it breaks.
Thanks.
I figured it out. I was going to deep into window.opener.location – for IE, I should stop it there, convert it to a string, and call it good. Which is what I did, and it now works.
So, instead of window.opener.location.href, I just used window.opener.location.toString() for IE.