Re: Launching Popups when Leaving a Site
by Kathy Wheeler <kathyw(at)home.albury.net.au>
|
Date: |
Wed, 27 Mar 2002 09:32:36 +1100 |
To: |
"Evans, Chuck" <CEvans(at)Empirix.com>, "HWG Languages (E-mail)" <hwg-languages(at)hwg.org> |
References: |
empirix |
|
todo: View
Thread,
Original
|
|
On Wednesday 27 March 2002 07:32, Evans, Chuck wrote:
> I have been asked to create a popup window that will only popup if a person
> leaves our site completely.
Try the "onunload=" event handler in the opening body tag.
> (BTW, please no lectures or lengthy discussions on the morality of popup
> windows. I hate them too, but my boss wants it.)
O'Reilly's "Javascript the Definitive Guide" agree with your sentiments:
"The onunload() handler is invoked when the user has instructed the browser
to leave the current page and move elsewhere. Therefore, it is almost never
appropriate to delay the loading of the desired new page by popping up
dialogue boxes (with Window.confirm() or Window.prompt() for example) from an
unload event handler."
... but then goes on to tell you how it would be done "for example". Haven't
tried it so can't vouch for it.
Cheers,
KathyW.
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA