Krash Posted April 1, 2011 Share Posted April 1, 2011 Have a validation form opening in a popup, and if input is correct, I want to close the popup and load a new page into the parent window. Works fine in an iframe, but the popup loads the new page into the popup, possibly because the form handler considers the popup its parent. Here's the code in the form handler - if ($mCode == $vCode) { echo '<br><span style="color:#00ff00; margin:auto;"> Validation successful. </span><br><br><br><br>'; $_SESSION['validate'] = '1'; $_SESSION['count'] = 0; echo '<script type="text/Javascript">setTimeout("parent.location.href=\'http://www.domain.com/subdir/index.php?action=register\';" , 0)</script>'; } Quote Link to comment https://forums.phpfreaks.com/topic/232373-cant-target-main-window-from-popup/ Share on other sites More sharing options...
Krash Posted April 1, 2011 Author Share Posted April 1, 2011 Did a little eperimenting, and this is what I got - // this opens new page in popup window.parent.location=\'http://www.domain.com/subdir/index.php?action=register\'; // this does nothing // window.opener.location=\'http://www.domain.com/subdir/index.php?action=register\'; // this closes popup // window.parent.close(); // this closes popup // window.self.close(); // this closes main window // window.opener.close(); Quote Link to comment https://forums.phpfreaks.com/topic/232373-cant-target-main-window-from-popup/#findComment-1195394 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.