Forum Moderators: open

Message Too Old, No Replies

Exit Pop-up

how to code it...

         

doctorkellogs

9:56 pm on Jun 28, 2005 (gmt 0)

10+ Year Member



Hello everyone!

I've read the forums but can't quite put my finger on what to do exactly, I'd appreciate a hand.

I'm looking to code an exit pop-up specifically when the user leaves my web page, a pop-up would appear.

But I don't want it to appear if he signs up in my subscribtion list!

Don't worry I'm not doing this to annoy people but it would be a short survey, my autoresponder aweber can code this with click & drag.

I've found this on one thread:

exited = 0;
function popup() {
if(exited) {... }
}

<body onunload="popup()">

<a href="internal.html" onclick="exited=0">Internal link</a>
<a href="http://www.example.com" onclick="exited=1">External link</a>

but how does it work? what do I put as a replacement to internal.html and the second url?

Thanks!

Rhen

tedster

11:44 pm on Jun 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That script assumes you want to deliver the pop-up when a person leaves your SITE, not just leave a page for another page on your domain.

So internal.html is any link that stays on your site - for these links you need to set the "exited" variable to 0 so the pop-up doesn't fire. For links that lead away from your site, you need to set exited to 1 so the pop-up script does fire. Those two urls can be any anchor tags you have on your site.

The other qualifitcation you mention (don't give the pop-up to people who have already signed up) is best handled with a cookie, I'd say.

doctorkellogs

9:18 pm on Jun 30, 2005 (gmt 0)

10+ Year Member



Thanks for your help

I am trying real hard to understand what you're saying here, but there's a few things you might be able to clarify for me...

I still don't understand what I should put in those two urls

What are anchor tags?

Rhen

Dijkgraaf

12:00 am on Jul 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Anchor tags are the <a ... ></a>
e.g. <a href="...">something</a>

So on any internal links (e.g. linkging to your own pages) you need to have onclick="exited=0" in the tag to prevent the popup happening.

Warning: lots of people HATE popups, so either they will be anyoing these people or they will be running a popup blocker and they won't see it. Are you sure you want to use popups?