6 Replies - 31724 Views - Last Post: 05 September 2006 - 04:45 PM

#1 flooga  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-April 04

Closing Child Popup From Parent Browser Window

Posted 06 April 2004 - 11:39 AM

I have a page with links. When users click a link, a little popup window opens and they have to read the popup and click a close button on the popup.

The problem I'm running into is that users sometimes forget to click close on the popup window. So, is there a way for the parent window (the one that launched the popup) to close the child popup when the user visits another page in the parent browser window?

I think what I want is something like this in the main parent page:

<body onunload=window.closeChildWindow()>


..or something similar.

Does that make sense? Is this even possible? Thanks in advance of your help.

- flooga

Is This A Good Question/Topic? 0
  • +

Replies To: Closing Child Popup From Parent Browser Window

#2 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1858
  • View blog
  • Posts: 20,275
  • Joined: 17-March 01

Re: Closing Child Popup From Parent Browser Window

Posted 06 April 2004 - 01:40 PM

What's the tag all the porn sites use when you close the browser and 85 windows open?!?!

I'm at work or else i would go look hahaha.
Was This Post Helpful? 0
  • +
  • -

#3 flooga  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-April 04

Re: Closing Child Popup From Parent Browser Window

Posted 06 April 2004 - 02:21 PM

skyhawk133,

Thanks for the answer but I'm not sure how that applies to my situation. I want the parent window to close the child popup when the parent has a 'onunload' event.

I certainly do not want to open more popups.

Thanks

- flooga
Was This Post Helpful? 0
  • +
  • -

#4 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1858
  • View blog
  • Posts: 20,275
  • Joined: 17-March 01

Re: Closing Child Popup From Parent Browser Window

Posted 06 April 2004 - 02:56 PM

Well, the concept behind my post was... depending on how the porn sites decide when the window is closed... whether it's using the onunload or some other event, they then execute a pop-up script... you are trying to do that in reverse... closeing the pop-up. You can reference a window by name, so I know you can do it, just not 100% sure on how, have't done much javascript as of late.
Was This Post Helpful? 0
  • +
  • -

#5 richowe  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 64
  • Joined: 15-May 04

Re: Closing Child Popup From Parent Browser Window

Posted 23 June 2004 - 07:46 AM

onunload="parent.nameOfChildwindow.close();"
Was This Post Helpful? 0
  • +
  • -

#6 linse  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 05-September 06

Re: Closing Child Popup From Parent Browser Window

Posted 05 September 2006 - 04:27 AM

View Postrichowe, on 23 Jun, 2004 - 07:46 AM, said:

onunload="parent.nameOfChildwindow.close();"



onunload="parent.nameOfChildwindow.close();" is working fine only when the url of the parent window is changed and is not working when the parent window is closed using the close button of the browser. :huh:

Can any one help?
Was This Post Helpful? 0
  • +
  • -

#7 Spider  Icon User is offline

  • Arachnid

Reputation: 2
  • View blog
  • Posts: 769
  • Joined: 10-July 02

Re: Closing Child Popup From Parent Browser Window

Posted 05 September 2006 - 04:45 PM

As far as I'm aware the only way to catch every way a user can move away from a page (through closing, clicking a link, etc.) is to add an event handler for each way of leaving the page.

There is a list of them here:
http://developer.moz...#Event_Handlers

Just pick out the ones you need and do the same thing for each one :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1