How do I open a form on page exit
I'm now dealing with a client request to 开发者_StackOverflow社区open a form when the user leave the page. Can that be done?
I think you are looking for
onbeforeunload event
An event that fires before the unload event when the page is unloaded.
It seems to be impossible to create my own form and override onbeforeunload or anything else. I guess blocking it is the right thing though..
What we did is to pop a form and use the regular onbeforeunload. if the user wants to go - he will. But if he stays - he will get the questionnaire.
You can see the issue here too: onbeforeunload confirmation screen customization
精彩评论