General discussion

Locked

Should be simple Javascript, right?

By mayest ·
I've found great examples on this site for complex or tricky Javascript situations, but I'm still stumbling around trying to find a simple solution to a simple problem... Or maybe it's not so simple? Here's the deal:

I have created a main page that, when you click on a link, spawns a popup window. When you click on a link in this new popup window, I want this popup window to close itself, and have the URL open up in the main parent window that initially spawned the popup. Could anyone pleaseshed some light on this simple(?) problem?

Thanks!

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

load URL first, then close window

by Jay Eckles In reply to Should be simple Javascri ...

When your control (hyperlink/pushbutton) is clicked, you first want to load the URL in the opener window, something like
opener.location.href = 'http://www.yahoo.com' ;
(although I can't remember right off if that's the correct syntax)
And only then close the pop-up:
window.close() ;

Collapse -

Thanks! -- This code did the trick

by mayest In reply to load URL first, then clos ...

<a href="#" onclick="window.opener.location='';self.close()">

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums