0

I'm now dealing with a client request to open a form when the user leave the page. Can that be done?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
David Salzer
  • 872
  • 1
  • 7
  • 24

2 Answers2

0

I think you are looking for

onbeforeunload event

An event that fires before the unload event when the page is unloaded.

rahul
  • 184,426
  • 49
  • 232
  • 263
0

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

Community
  • 1
  • 1
David Salzer
  • 872
  • 1
  • 7
  • 24