Hey there... That was a bit harsh this is a completely valid approach to
perform certain things, but can be used in very irritating ways in the
wrong hands. I have used exit popups a number of times for surveys and
they work well. They catch people while the site is fresh in their minds
and can give you and your client valuable feedback on things like
usability. Overall my clients have had very few complaints from site
visitors. Follow the basic rules-
1. Ask permission
2. Tell people what you are doing
3. Don't write code that doesn't work
4. If at all possible don't do it to everyone. Sample ing a portion of
your traffic is something that you can usually sell to a client.
The best way that I have found to do this may not work for you but think
about it.
For surveys typically I opt the person into a survey group with a
request to participate in a study on entry. Their opt-in request opens
small new window (getting past popup blockers). Blur the new window to
get it out of the way. In the page that is loaded in the small window
evaluate the opener.location periodically using setTimeout to see if it
is not your site. If it is not, resizes the small window, redirect to
the page that you want to display and give it the focus.
This method obviously requires a second window to continue evaluating
the state of the opener and will need some more sophisticated logic on
sites using subdomains/multiple domains, but it does hold together on a
good swath of OS/Browser combinations.
good luck
> Hey there... That was a bit harsh this is a completely valid approach to
> perform certain things, but can be used in very irritating ways in the
> wrong hands.
There is *nothing* "valid" about a flawed approach. The entire idea is
flawed before you ever start.
> I have used exit popups a number of times for surveys and
> they work well.
Then perhaps you can answer my question I have alread asked in this
thread. Since you did not quote what you are replying to, I will ask it
again. Consider this scenario:
User bookmarks page14.html of your site.
User opens index.html of your site, navigates through page3.html.
User opens page14.html from bookmarks.
Does the user get an exit popup or not? Since they "left" the site
without clicking a link from it, yet they are still on the same site, do
they get the popup?
Second, I will *never* see a popup window when I enter or leave a site.
So, how do you give me a survey that I never see? And, how does that
"work well"?
> They catch people while the site is fresh in their minds
> and can give you and your client valuable feedback on things like
> usability.
<a href="survey.html">Fill out a survey</a>
That does the same thing, without the unwanted side effects of popup
windows.
> Overall my clients have had very few complaints from site
> visitors. Follow the basic rules-
> 1. Ask permission
How do you "Ask permission" to give me an unwanted popup?
> 2. Tell people what you are doing
> 3. Don't write code that doesn't work
#3 alone prevents people from doing what was asked about in this thread.
There is *no* reliable way to know whether I am still on your site or
not. The most a page can tell is that you are leaving it. Given the
above scenario I asked about, it shows that any code that attempts to
determine where I went when the page unloads will *not* "work".
> 4. If at all possible don't do it to everyone. Sample ing a portion of
> your traffic is something that you can usually sell to a client.
And a simple link to a survey does that.
> The best way that I have found to do this may not work for you but think
> about it.
I have. Have you?
> For surveys typically I opt the person into a survey group with a
> request to participate in a study on entry. Their opt-in request opens
[quoted text clipped - 3 lines]
> is not your site. If it is not, resizes the small window, redirect to
> the page that you want to display and give it the focus.
Open a popup, track the URL of the parent window? And without crossing
into a cross-domain security issue? Sample Code?
> This method obviously requires a second window to continue evaluating
> the state of the opener and will need some more sophisticated logic on
> sites using subdomains/multiple domains, but it does hold together on a
> good swath of OS/Browser combinations.
Example Code? I want an example of a popup code window that when I leave
your original site it can tell me the URL of the site I am on after I
leave your site.

Signature
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly