Jump to content

Popup Recall


jaymc

Recommended Posts

I have a webpage (A)

 

I want to launch a popup (B) from that webpage, in the popup will be a link

 

When clicked, I want the link to open up inside of the original webpage (A)

 

Do I need to assign it a javascript name or something

 

Window.name=''?

 

Please advise

 

Thanks

Link to comment
Share on other sites

Ok, that word great

 

However, lets say I have 2 main pages

 

Mainpage A

Mainpage B

 

Both can launch the pop

 

However, I want to force the popup to load the content in Mainpage A

 

If Mainpage A does not exist (browser has been closed) and the popup was launched from Mainpage B, I dont want it to launch it in Mainpage B, I want it to launch it in a new window

 

Thats why I was on about assigning a name

 

So basically

 

if launcher was Mainpage A, load content in Mainpage A, if it wasnt Mainpage A or Mainpage A doesnt exist, load content in new browser

 

Any idea?

Link to comment
Share on other sites

for that, you would need to create a function in Mainpage A to handle the redirection like this

<script language="javascript">
function redirect_page(url){
	location.href=url;
}
</script>

 

and in you pop up, you'll have something like this

<script language="javascript">
function redirect_parent(url){
	try {
		opener.redirect_page(url);
	}
	catch(e){
		// if no redirect function is around
	}
}
</script>
<a href="test2.html" onclick="redirect_parent(this.href); return false;">Click here</a>

this function will try to use the Mainpage A redirect function, if it's not there nothing will happen.

 

Note, only the window that opened the pop-up will be the "opener", if you want to have both A and B open and the B generate the pop up, A won't be effected. For that you would need to have the main page that generate pop-ups for A, B, and the pop-up and assign names to them. All the functions will be in the main page to handle the different windows.

 

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.