Forum Moderators: open
I'm trying to get a child window to redirect its parent window more than once:
- main page (parent), opens popup (child)
- child redirects parent (child doesn't close)
- child can then redirect parent again
I can always get it to work once. After that, I receive an access denied error message. I believe this is because I've killed the parent/child relationship.
I read that this may be able to be accomplished with frames in the parent page (a hidden frame that maintains the relationship). I've tried to this with no success. Is this even possible?
Any help would be appreciated!
Thanks.
Here's a few pages for your test:
[b]Opens in child (testpage.html):[/b]
<script type="text/javascript">
locas=new Array("testpage2.html","http://www.yahoo.com","testpage3.html");
i=0;
function swapParent() {
clearTimeout(doSwap);
opener.top.location.href=locas[i];
if (i<2) {
i++;
doSwap=setTimeout('swapParent()',5000);
}
}
doSwap=setTimeout('swapParent()',5000);
</script> [b]Original parent window (testpage1.html):[/b]
<h1>Test Page 1</h1>
<a href="javascript:void(window.open('testpage.html','test','width=200,height=100'))">Open Child</a> [b]testpage2.html:[/b]
<h1>Test Page 2</h1> [b]testpage3.html:[/b]
<h1>Test Page 3</h1> Does this switch the page successfully, even with Yahoo in the middle, there? :)
There are a couple of security issues which may be coming into play. Would you please post your code?
You were right on with the security issues. I was redirecting the parent to another server/domain and then would get Access Denied the next attempt. When staying within my domain, my code worked as expected with the child redirecting the parent to multiple sites.
Thanks.