Jump to content

Help with OnUnload


Riparian

Recommended Posts

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

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.