homepage Welcome to WebmasterWorld Guest from 54.167.11.16
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Access Denied on Window.Opener
Intermittent MSIE error
rocknbil




msg:1474766
 8:43 pm on Jan 20, 2005 (gmt 0)

I assign a new window ID a window and open it:

function options(pid) {
var day = new Date();
var id = day.getTime();
var url='scriptname.cgi?d=Edit+Options&pid='+pid;
var win = open(url,id,'width=400,height=400,resizable,scrollbars');
}

This small pop-up window does a sub-function on a relational table: for example, if you're editing a product, this window edits the options , such as color, size, and type. On closing that window, I execute the following so that any option details in the pop-up are updated in the main page via the refresh:

function closeRefresh() {
if (window.opener &&!window.opener.closed) {
window.opener.location.reload();
window.close;
}
}
<form onSubmit="return false;"> <-- Thx BernardMarx :-) -->
<input type="submit" onClick="closeRefresh();" Value="Close and Return to Product edit">
</form>

Most of the time this works, but sometimes I get the Access Denied error. I've also changed it to window.opener.document.location.reload();, same effect. Since it's intermittent, it's not something you can debug by any normal means.

This all takes place on the same domain, so I can't imagine why it's choking on the acess error, any ideas?

 

korkus2000




msg:1474767
 2:09 pm on Jan 21, 2005 (gmt 0)

What versions of IE are having the error?

CaseyRyan




msg:1474768
 3:05 pm on Jan 21, 2005 (gmt 0)

When I've had this situation before, instead of calling reload of the opener from the popup, I have the popup call a function in the opener which does the reload; then the popup closes itself. I don't know if this would fix your problem but when I've used it to do the same thing you're trying to, and I've never experienced an error.

popup code:
function closeRefresh() {
if (window.opener &&!window.opener.closed) {
window.opener.refreshPage();
window.close;
}
}

new opener javascript:
function refreshPage(){
document.location.reload();
}

-=casey=-

rocknbil




msg:1474769
 4:33 pm on Jan 21, 2005 (gmt 0)

What versions of IE are having the error?

This particular case is 6.0.2800.1106, running win2K.

When I've had this situation before, instead of calling reload of the opener from the popup, I have the popup call a function in the opener which does the reload; then the popup closes itself.

Actually all my Javascript is in an external file and both the opener and pop-up are linked to it. I'll try loading it in the opener only. Seems like if it would find the opener (if (window.opener) it shouln't kick off a security denial . . .

The difficult part is it's intermittent. It will go for days witohut an error then out of nowhere "access denied."

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved