Forum Moderators: open
My boss wants the links in the popup window to point back to the original window.
How can I do this? Any help would be appreciated. Thanks.
<a href="#" onClick="window.opener.parent.location=newURL">Link</a>
Something to consider: When the original window loads a new document, the pop-up window loses focus. For this reason, I often add a window.close() to the onClick handler.
Thanks Tedster.
Here is my dilemma though. If a person comes to my original pages by other means other than my link, than the whole thing won't work properly. :(
So I'm really kinda looking for a way to do this without naming a link to the original window. I am thinking this is probably impossible, but I can always be hopeful! :)
Thanks again.
function nav(u)
{
window.opener.focus();
window.opener.location.href = u;
}
Your links can use it like this:
<a href="javascript:nav('myUrl')">click here</a>
Of course, if javascript is disabled, that won't work. In that case, I'm not sure what to do. You can't use the target attribute of the A element, because you don't know the parent window's name. And if the parent window is the initial window... you can't assign a name if javascript is disabled.
Hmmm... I'm sure some of these gurus here knows how to do it. I also would like to know.