javascript - Detecting whether user stayed after prompting onBeforeUnload -
I am working in a web app, I'm already capturing to ask the user that he In fact wants to get out.
Now, if he decides to stay, there are many things I want to do. I am trying to explain that he was deciding to live in reality.
I can definitely declare a timeout for "X" seconds, and if it is a fire, it would mean that the user is still there (because we did not unload). The problem is that the user can take any time to decide whether to live or not ...
I was hoping for the first time that when the dialog was appearing, set-timeout Calls do not have a fire, so I could set a timeout for a little while and this only if the user chose to stay, however, when the do dialogue is shown at the end of time, So it does not work .
Whatever I have thought is catching a mouse map on the window / document. Though the dialog is shown, but in reality, except for a strange exception that applies to my case, the mousewatch does not actually fire, so this will not work.
Can someone think of doing this in another way?
Thank you
(If you are curious, the reason for capturing a mouse move is not that my page has an iframe, which has one site from the other When loading the page, the focus is inside the IFrame, while the dialog shows, then I get the mousevive event firing once when the mouse moves out of the IFrame (at least in Firefox). Probably a bug, but Still, it is very likely that in our case Oh, so I can not use this method).
What I was doing in the click event for my document, and once I received a click If I did, I would have believed that the user stayed on.
This is not a good solution, in most cases (if you are a DiggBar) you will have many false NGT Ves (people will live and you will never know it), but in our case This makes sense, because people do much with our sites, not only with framed sites.
Specifically, my code does this ...
function on-backload () {event. Work (document, "click", user-created); If (IconiderAframitebettingTipop) {Return "The site is trying to avoid. Do you want to stay?"; }} Function User () {Event.stopObserving (Document, "Click", UserStayed); // New to let us know that the user is still with us}
Comments
Post a Comment