Forum Moderators: open
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
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.
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?