Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #13144
| From | zephyr <marc.at.compass@gmail.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | how to detect a page unload via closing a window |
| Date | 2012-03-28 08:00 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <4192865.8.1332946844959.JavaMail.geo-discussion-forums@vbuf25> (permalink) |
Hi, I want an alert to appear when the user closes a browser window. That is easy enough - onBeforeUnload fires before unloading the window. But I want that alert only to show when the user leaves the page by closing the window: clicking the little x in the tab or top-right/left (Mac) of the window. I don't want this alert to show when the user leaves the page by clicking a next button (since that is a legitimate pageunload). Also when he does a refresh, I don't want this alert to show up. OnBeforeUnload fires at all events when the current page is unloaded, be it from a close box click, a refresh or simply a redirect to another page. Hope my question is clear... Is there a way to do what I want? Marc
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
how to detect a page unload via closing a window zephyr <marc.at.compass@gmail.com> - 2012-03-28 08:00 -0700 Re: how to detect a page unload via closing a window David Mark <dmark.cinsoft@gmail.com> - 2012-03-28 20:19 -0700
csiph-web