PDA

View Full Version : Advanced pop up question


netshop01
12-21-2002, 07:22 AM
I want to display one pop up when someone leaves my website.

It seems like a simple request, however because my pages are dynamically generated the pop up is triggered even when the visitor clicks through to another page on my website.

I have looked everywhere with no luck. Does anyone here know how to do this?

kwhubby
12-21-2002, 07:40 AM
well, you can use the OnUnload in the body tag, and than do a window.open()

so <body OnUnload="window.open(......)" >

kwhubby
12-21-2002, 07:53 AM
oh whoops never mind, that would do the same if you were to go to a different page, so it would not work for your case, but you could probobly develope a script using cookies or a docked window

requestcode
12-22-2002, 12:36 AM
This question comes up a lot. As far as I know there is no way using JavaScript to do this. It would be very difficult to determine if they were leaving the domain or going to a page within your domain. What I have seen is a window popup on the main page when they go to another page either within the domain or outside. A cookie is used to check if the window has popped up in the same browser session and if it has it won't pop up again. Here is link to a sample script:
http://javascriptkit.com/script/cut65.shtml