Jump to content

Can't target main window from popup


Krash

Recommended Posts

 

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>';
}

 

Link to comment
https://forums.phpfreaks.com/topic/232373-cant-target-main-window-from-popup/
Share on other sites

 

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();

 

:shrug:

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.