Jump to content

[SOLVED] close window open new link


severndigital

Recommended Posts

ok I am having problems with this one.

 

here is what i want to do.

 

1. open a popup window.

2. when a specific link is click in the new window I want to close it and open the link in the original window that the popup came from.

 

currently I have the code in place to popup the window.

 

I can also close the window with the self.close command.

 

can anyone help me with a function that will close the window and open a link in the original window.

 

or is it even possible??

 

thanks,

chris

Link to comment
Share on other sites

thanks for that link .. i found what i was looking for.

 

for anyone else .. this how i did it.

 

in the popup window head

<script language="JavaScript">
opener.name = 'main'; //name the opener

function closePopup(link){
window.open(link ,'main');
self.close();
}
</script>

 

then on the link you want to use add this as the href

 

<a href="javascript:closePopup('linkyouwant.htm')">click here</a>

 

that closes the popup and opens the link in the href in the opener window.

 

not sure if it is the 'best practice' but it got the job done for me.

 

thanks again,

chris

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.