Welcome to WebmasterWorld Guest from 54.167.46.29

Forum Moderators: open

Message Too Old, No Replies

JS: Popup window on site exit

     
10:26 am on Jul 30, 2002 (gmt 0)

New User

10+ Year Member

joined:July 30, 2002
posts:2
votes: 0


Hi,

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?

Andy

11:40 am on July 30, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 10, 2001
posts:793
votes: 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...

You could stick javascript on every internal link on your site that cancels the onunload event but it still won't fix the problem for refreshes or people typing in another URL in your domain... forget it.

PS, Welcome to WebmasterWorld.

5:08 pm on July 30, 2002 (gmt 0)

Preferred Member

10+ Year Member

joined:June 7, 2002
posts:475
votes: 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 July 30, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:June 14, 2001
posts:103
votes: 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 July 30, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 10, 2001
posts:793
votes: 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...