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
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:

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.