Forum Moderators: open
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?
popup code:
function closeRefresh() {
if (window.opener &&!window.opener.closed) {
window.opener.refreshPage();
window.close;
}
} new opener javascript:
function refreshPage(){
document.location.reload();
} -=casey=-
What versions of IE are having the error?
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."