playaz Posted August 7, 2009 Share Posted August 7, 2009 Hi guys, This is probably really simple but I am not sure how it is done. Basically, I have a page (page 1) that has a standard text link that when the user clicks the link opens this in a new pop-up window (page 2) - in the new window when the user clicks a link it should close the pop-up and load this new URL in initial page (page 1). So in simple terms, page 1 is always there, while page 2 closes itself when a link from within page 2 is clicked.. Any ideas or code on how I can achieve this? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/169227-solved-open-a-new-window-in-the-previous-window-closing-the-current-window/ Share on other sites More sharing options...
watsmyname Posted August 7, 2009 Share Posted August 7, 2009 Hi guys, This is probably really simple but I am not sure how it is done. Basically, I have a page (page 1) that has a standard text link that when the user clicks the link opens this in a new pop-up window (page 2) - in the new window when the user clicks a link it should close the pop-up and load this new URL in initial page (page 1). So in simple terms, page 1 is always there, while page 2 closes itself when a link from within page 2 is clicked.. Any ideas or code on how I can achieve this? Thanks in advance page 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script> function open_window() { window.open('2.html','pwindow','status=1'); } </script> </head> <body> <a href="javascript:open_window()">Open Popup</a> </body> </html> page2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script> function open_window() { window.opener.document.location.href="http://www.google.com"; window.close(); } </script> </head> <body> <a href="javascript:open_window()">Open page in parent window</a> </body> </html> Link to comment https://forums.phpfreaks.com/topic/169227-solved-open-a-new-window-in-the-previous-window-closing-the-current-window/#findComment-892931 Share on other sites More sharing options...
playaz Posted August 7, 2009 Author Share Posted August 7, 2009 Thanks for the quick reply 'whatsmyname' I will give your code a whirl :-) Link to comment https://forums.phpfreaks.com/topic/169227-solved-open-a-new-window-in-the-previous-window-closing-the-current-window/#findComment-892949 Share on other sites More sharing options...
watsmyname Posted August 7, 2009 Share Posted August 7, 2009 Thanks for the quick reply 'whatsmyname' I will give your code a whirl :-) its watsmyname okay sure thing, after you think it works dont forget to mark topic as "SOLVED" Link to comment https://forums.phpfreaks.com/topic/169227-solved-open-a-new-window-in-the-previous-window-closing-the-current-window/#findComment-892966 Share on other sites More sharing options...
playaz Posted August 13, 2009 Author Share Posted August 13, 2009 cheers watsmyname - i scan read it without reading it properly must be my selective memory! thanks! Link to comment https://forums.phpfreaks.com/topic/169227-solved-open-a-new-window-in-the-previous-window-closing-the-current-window/#findComment-897132 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.