Riparian Posted March 8, 2012 Share Posted March 8, 2012 Sorry I am not proficient at javascript. Problem I call a popup window where the client views different products and has the option to add a product to the cart. The page can be refreshed a number of times By using <body onunload="opener.location=('$ret')"> the parent window is refreshed every time the child window is refreshed Worse still is that if the client clicks a <a href="<?=$_SERVER[php_SELF]?>? etc etc... in the popup window it closes the popup window all together Question . Is there a way to only set the onunload to work where say, window.self.close() event is activate or click the x in the window itself ? In other words the client can do whatever in the popup window and the calling window only refreshes when the popup window is closed I am using this script donated by a generous soul on the net... <script language="JavaScript"> <!-- function refreshParent() { window.opener.location.href = 'MyCallingPage.php?page=<?=$page?>'; if (window.opener.progressWindow) { window.opener.progressWindow.close() } window.close(); } //--> </script> <body onunload="refreshParent()"> Any help is greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/258499-help-with-onunload/ Share on other sites More sharing options...
scootstah Posted March 8, 2012 Share Posted March 8, 2012 This is very easily accomplished with jQuery's Dialog widget. Link to comment https://forums.phpfreaks.com/topic/258499-help-with-onunload/#findComment-1325211 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.