We're tryin to implement some kind of feedback, which I saw in MSDN web-site. More concrete when user first enters to our site, I want to show a pop-up which will ask user to leave comment rite before he would leave our web-site, and depending on user's answer( it would be some kind of confirmation box with Yes and No), I want to open a pop-up with TextBox for user to leave a feedback. I've searched for this in internet, but all of 'em was about handling window.onload event, the problem is we have more than one page, so I won't be able to determine if user requests another page in our web-site or redirects to another web-site. So this is my problem, any suggestions? We're using asp.net. Thanx beforehand.
-
14I encourage you to *not* do this. It's very unfriendly to users. If they want to leave, they want to leave. – Michael Petrotta May 02 '11 at 18:35
-
possible duplicate of [Display a warning when leaving the site, not just the page](http://stackoverflow.com/questions/2365994/display-a-warning-when-leaving-the-site-not-just-the-page) – brendan May 02 '11 at 18:37
-
+1 @Michael Petrotta. @jas_cart this is not a good practice nor a good way to implement feedback. On my projects I have a tiny feedback icon located in our footers that pops up a dialog. It also have a 5/5 star rating control and is used frequently. – pixelbobby May 02 '11 at 18:38
-
1@Michael Petrotta And this will serve as a reassurance that leaving was the right choice. :-p – Wiseguy May 02 '11 at 18:41
2 Answers
I dare to say this is not possible. In the old days when a developer wanted to cut user's fingers off they removed browser chrome completely, so users were left to clicking only links within the border-less window. This was (almost) the only way for users to close the window to provide a button close.
But these days are gone. You can't hide browser away anymore due to security reasons. And I personally think that's very bad practice as well.
You can only detect whether someone is leaving your page. But you can't know for sure whether they are leaving due to doing some action within your page (unless you add functionality to every action on it) or they've maybe clicked back or even forward browser history button. Not to mention they've written a web address in the address bar or even searched Google via search bar... I don't even want to think about all the possible browser plugins/extensions that may redirect users to whatever page they like. What about browser upgrades? Will they provide some sort of special functionality you can't think about? Well too many variables to this equation for my taste.
I strongly suggest you don't do this
This is simply bad user experience
When one wants to leave your site, they want to leave it. Even though you'd present them a survey, they could just as easily click close or go elsewhere (maybe even happier to close it). So there is no obvious reason for you to present this survey on user leaving.
Even Microsoft does it on page load. And if someone says Yes they are presented with participation survey right away. Not waiting until they leave the site...
The only reason is of course that you want to collect data after they've used your site/app. Well bad luck. Unless you track users in which case you could present them survey on their re-visit, but they are more loyal already so results would be biased.
Surveys/feedbacks should be as unobtrusive to users as possible.
Otherwise people just won't fill them up.

- 103,639
- 52
- 277
- 404
-
Thanx for your answers, I know it's not a good practice, and I'm not goin to annoy my users, just if user first visiting my web-site I want to ask him, if he wants to leave a feedback, and if user wants(by clicking YES button for example) I would like to show feedback form to user when he will be abt to leave my web-site. From what you post I consider, it would be better if I will open a new feedback window, and let my user to decide when to leave a feedback. Once again thanx for your answers, I'm greatly appreciated. – jas_cart May 03 '11 at 05:40
The problem is, it's not really possible to know definitively when someone is "leaving" your web site.
You could try to capture via Javascript when they are navigating away from pages on your site, but even if you do that, and you know they are going to a page on some other site, you could easily get 'false positives" there if, for example, someone has your site open in multiple tabs.
I think that is the reason you usually find such "feedback popups" either come when you first visit a site, or come during some process in the application itself - such as at the end of a shopping cart purchase.
Without hindsight, there really is no way to know what the last page someone is visiting on your site will be.
And in the comments, others have noted that this type of behavior would likely annoy your users... even if they opted-in to it somehow upon visiting the site.

- 39,603
- 20
- 94
- 123