Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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