Jump to content

Popup Recall


jaymc

Recommended Posts

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
https://forums.phpfreaks.com/topic/47486-popup-recall/#findComment-231781
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
https://forums.phpfreaks.com/topic/47486-popup-recall/#findComment-232359
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.