homepage Welcome to WebmasterWorld Guest from 174.129.163.183
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Popup on exit
joshuaip




msg:600061
 7:30 pm on Nov 19, 2003 (gmt 0)

Im trying to create a pop up on exit so people can be offered a subscription to my newsletter and am using the Unload java routine...however this means if they leave that page at all (to goto another page) it pops up, if they go back then go somewhere else it pops up...

does anyone know how I can only make it pop up once per user or only if they are closing the page entirely, or leaving my domain entirely?...please let me know.

Thanks,
Joshua

 

DrDoc




msg:600062
 7:36 pm on Nov 19, 2003 (gmt 0)

You can use onunload if you make a change to your popup function and all links.

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>

joshuaip




msg:600063
 11:51 am on Nov 20, 2003 (gmt 0)

I am already using the onunload function but that still pops a window if the user visits any other link on the page...and also if they come back and go again ...

rpking




msg:600064
 11:59 am on Nov 20, 2003 (gmt 0)

The important thing about DrDoc's example is the onclick parameter. This sets a flag which determines whether the link is internal or external.

This prevents the popup appearing as users navigate through your site.

joshuaip




msg:600065
 8:06 am on Nov 21, 2003 (gmt 0)

so i just write all the links I have on the page into that script? Is there a shorter version? Im trying to obvoiusly keep page size down?

DrDoc




msg:600066
 3:09 pm on Nov 21, 2003 (gmt 0)

No, you just add an onclick attribute to your links...

...
<script type="text/javascript">
exited = 0;
function popup() {
if(exited) {...}
}
</script>
</head>
<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>

hemebond




msg:600067
 3:14 am on Dec 4, 2003 (gmt 0)

Or, don't use popups on unLoad. Poeple will hate you for it. If you want people to sign up to a newletter, put something on your website. Don't spam them.

DrDoc




msg:600068
 3:17 am on Dec 4, 2003 (gmt 0)

Welcome to Webmaster World, hemebond!

There's nothing wrong with using popups -- depending on how you use them. But I'm sure you realize that too, that there are good and bad uses. In this case... Well, I won't go there ;)

asquithea




msg:600069
 9:45 am on Dec 4, 2003 (gmt 0)

... but I will.

1) joshuaip, as a visitor to your site, I wouldn't see your pop-up unless I'd explicitly allowed it. Nor would most users of a non-Microsoft browser. When the next version (or service pack) of Internet Explorer comes out, neither will most Microsoft users. So, there's not a lot of point wasting your time on this now.

2) A number of surveys have been done that show users hate popups. We're talking 90%+ here, and some users will avoid your site as a consequence. A mac site [lowendmac.com] came up first when I searched about this topic, but it looks pretty typical.

3) Adding scripts to your pages will make them larger, load and run slower, make them more fragile, and increase your maintenance workload. They also won't work in some browsers, since some users disable some annoying aspects of Javascript (this can easily be done in Mozilla Firebird), or disable it altogether.

YouDonkey.com [youdonkey.com] has an article about 10 Easy Steps to lose your customers [youdonkey.com], which repeats common knowledge but is still worth a look. Ironically, the page contains some scripting that prevented me from using a mouse-gesture to navigate back to Google. They just lost my custom, and I only looked at one page.

To summarize, I think it's a bad idea, though others may beg to differ. Provide a link that people can click to subscribe -- even with a pop-up window (onclick) if you like -- but don't force it onto users.

Hawkgirl




msg:600070
 11:03 am on Dec 4, 2003 (gmt 0)

I've done an exit popup the way DrDoc described them here and it worked really well.

Hemebond and Asquithea, you guys might want to check out some of these threads debating the merits of popups. Lots of good arguments to be found here:

[webmasterworld.com...]
[webmasterworld.com...]
[webmasterworld.com...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved