jaymc Posted April 18, 2007 Share Posted April 18, 2007 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 https://forums.phpfreaks.com/topic/47486-popup-recall/ Share on other sites More sharing options...
nogray Posted April 18, 2007 Share Posted April 18, 2007 you can use the opener attribute to redirect webpage (A) to the URL <a href="URL_GOES_HERE" onclick="opener.location.href=this.href; return false;">Click here</a> Link to comment https://forums.phpfreaks.com/topic/47486-popup-recall/#findComment-231761 Share on other sites More sharing options...
jaymc Posted April 18, 2007 Author Share Posted April 18, 2007 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 More sharing options...
nogray Posted April 18, 2007 Share Posted April 18, 2007 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.