Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

How to block “Leave site” prompt?

I've got cycled forms in react. Form1, Form2. This is how it goes:

Form1 mounts Form1 sumbits Form1 unmounts Form2 mounts Form2 sumbits Form2 unmounts Form1 mounts

So form itslef is not dirty but when I try to close the tab I get "Leave site" prompt. This is what I tried so far: 1. Reloading page through code, various variations of it, prompt still appears 2. Modifying and removing window onbeforeunload event, also various variations of it 3. Resetting the form on mounted component 4. modifying onbeforeunload event on form sumbit event 5. navigating with history from react router, I can even come to other route which shows other page but I still get prompt if trying to close that page (that page doesn't have form at all)

I am using Chrome 71.

Comments