pop up

They have: 121 posts

Joined: Apr 2003

I want to run a one week "exit on browser" popup that will ask questions to the potential poll(er. I'd like this pop up to occur when a visitor closes the browser or leaves the site via a link or entering another URL. Can anyone help. I know there are other ways of going about getting this info, but this is the way we want to do it. It's only going to run for one week. Any help is Cool

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

There are two parts here -- which do you want answered?

1. How to make a window popup on exit?

A: onload(); in the body element. This is JavaScript, not server-side coding.

2. Scripting a poll

A: Depends on what you want to do with the information, server-side coding, and mail results or insert them into a database or both.

They have: 121 posts

Joined: Apr 2003

Oh yes, sorry. Either one is fine. I'd rather have #2 if at all possible. Then I can check every so often to see the results. Does that make since?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

... no, that doesn't really make sense.

There are two PARTS. It's not an either/or situation. You can have the poll on your page or in a popup (part i), and then, how will you get the information from the poll (part ii).

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Also, you may want to reconsider using a popup at all -- http://www.zeldman.com/daily/0603a.shtml#autopop

Many users choose to block popups. Smiling

They have: 121 posts

Joined: Apr 2003

That's fine. I'm just looking for some feedback. If they happen to block it, fine. They'll never see my company. This just means that it might take a little longer than I expected to get the results I want. Plus how many people us Mozilla? Not very many.

So what are those steps again?

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

It's not just mozilla, AOL are automatically including a pop-up killer with their package and many people actually pay for pop-up killer software now as they are just so sick of them. Personally I would rethink using pop-ups for gaining information.

Julia - if life was meant to be easy Michael Angelo would have painted the floor....

They have: 121 posts

Joined: Apr 2003

Ok, guys. I knew I was going to have to jump through hurdles to get some answers around here. Can I just please get some help.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Sweetie, I've already answered you. However:

1. develop a server-side poll processing script (or find one that's available as for use on a commercial site)

2. put it in its own page

3. use JavaScript to pop the window up when the user leaves the page

If you want to do it when people leave the site, I'm really not sure. I haven't bothered to learn how to do it because it's such a fundamentally bad idea. I would assume you'd have to set a cookie so they didn't get it on every page as they travel through the site or something.

He has: 296 posts

Joined: May 2002

You'd have to use OnUnLoad(). Like so:

<body onunload="window.open(...)">'

Example (untested):

<html>
  <head>
    <title>New Document</title>
    &lt;script type="text/javascript"&gt;
    <!--
    function Exit() {
        var page = "poll.php"; // Page to open
        var name = "poll"; // Name of window
        var h=600; //Height
        var w=800; //Width
        newWin=window.open(page, name, w,h",directories = no,location = no, menubar = no,resizable = no,scrollbars = no, status = no,toolbar = no,screenX = 0,screenY = 0,top = 0,left = 0");
        newWin.focus();
        return false;
    }
    -->
  </head>
  <body OnUnLoad="Exit();">
  </body>
</html>
'

[James Logsdon]

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

But surely that would have to be put onto every page, as you don't know what page people will leave from, and then you'd have the pop-up coming up everytime the page 'closed' when they clicked a link to another page?? Maybe you'd need to add some code to create a cookie so that it only opened once?

Julia - if life was meant to be easy Michael Angelo would have painted the floor....

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Thanks for correcting my typo, too, lol...

Yes, you'd have to set some state or you'd be spamming the user endless with your pleading for them to answer the poll. Not exactly the way I'd want to leave a customer who may have been leaving my site with a favourable attitude until being attacked by the popup.

I really do think that, while it's possible to do it, it's better for your users AND for you to have the poll embedded into the website (on every page if you want) asking for the feedback. If you want the feedback, don't force them to give it to you or you're going to get a lot of nonsense feedback or worse, none at all.

For instance, the Washington Post makes you fill in a quiz every time you visit their site, for demographics. Every time I give them different information because it's a) totally invasive information that they are asking and b) a highly ineffective way for them to be asking and c) it makes me annoyed every time I view the screen.

So annoyed that I will consciously avoid links to their site now, so whatever news they are reporting, I'm not reading it and their value to me as a news source has plummeted.

They have: 218 posts

Joined: Apr 2001

Pop-up blockers stop a lot of sites from working (including hotmail email accounts). People will have to learn to turn it on and off. I have Naviscope, and I toggle it on and off if I know a site has spam. Lots of people use mozilla.

Onunload popups are just annoying period. But other uses of javascript are very valid. Create a poll with a server side scripting, then display it in a new window if that's what you are looking for.

TonyMontana
electricmountain.com

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.