Link to home
Start Free TrialLog in
Avatar of lhutton
lhutton

asked on

Load New Page In Parent / Close Popup Window

I've added the following script to a popup window that's opened when a link in it's parent is clicked:

   function OpenInMain(mainurl) {
     window.opener.location=mainurl;
     return;
   }

with the following link:

<A HREF="javascript:OpenInMain('http://www.newsite.com/')" onClick="window.close();">New Site</A>

This loads a new page in the parent window, but it won't close the popup window. How can I do that at the same time?
ASKER CERTIFIED SOLUTION
Avatar of a.marsh
a.marsh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lhutton
lhutton

ASKER

Ah! I tried window.close(); in the script but didn't even think of using window.opener.focus(); as well!

Cheers :)
Glad to help. :o)

Ant