|JS: Popup window on site exit|
| 10:26 am on Jul 30, 2002 (gmt 0)|
Does anyone know how to make a popup window appear when a site is left or the browser is closed?
I've tried using the onUnLoad() method, but that pops up a window when each site page is left, rather than when the doamin is left.
Anyone have any ideas?
| 11:40 am on Jul 30, 2002 (gmt 0)|
Nope, you can't tell the difference between an onUnLoad called by Refresh, closing the browser, typing in a new address, clicking a link in the same domain and so on...
PS, Welcome to WebmasterWorld.
| 5:08 pm on Jul 30, 2002 (gmt 0)|
You could try using a frameset -- you can have a frameset consisting of only one frame -- and using an onunload handler in the frameset. All your offsite links would then need target="_top" and this should, theoretically, work. There are other sneaky techniques, such as a small popup moved offscreen that periodically checks the closed property of the window in question.
However, it's a pretty damned annoying thing to do. It's what porn sites do to try to prevent you from leaving, and absolutely nobody likes it. (Not that I habitually surf porn sites, you understand...)
I reckon every popup loses you a sale. A popup on exiting might not lose you the sale, but it will almost certainly lose you any repeat business.
| 5:17 pm on Jul 30, 2002 (gmt 0)|
Using cookies i find that it doesnt annoy visitors too much
cos they only get shown the pop up once
Might be a solution
| 6:14 pm on Jul 30, 2002 (gmt 0)|
Whilst Rewboss's frameset solution is a good one, you should note that it still doesn't fix the problems with a user refresh or typing in a URL on your domain. You have the added problem of squeezing users into the frameset even if they come through an SERP (Search Engine Results Page*). As you're probably beginning to see now, it's just not worth the trouble.
*Is that right? I've always just thought it stood for that...