How do I prevent the Stay/Leave pop up that appears on navigating away from the form?

vidhij
Giga Contributor

Hi all,

I have a requirement where if a value is changed on the form then take a confirmation - if yes, then reload the form (basically dont save anything) and if no, then set a flag and let user save the information.

Now, I know how to make it work using confirm("My message") alert BUT the out-of-box alert is adding the complexity. No matter what user select on my pop-up, the final decision is driven by this pop-up.

find_real_file.png

Is there a way to get rid (or control) of the above pop up that shows confirmation message "Do you want to leave this site?".

Any inputs are highly appreciated.

Thanks.

4 REPLIES 4

Blaze2
Kilo Guru

I had this issue before



I had to install TamperMonkey extention on chrome and use this script


Block Exit Blockers User Script


vidhij
Giga Contributor

Hi Blaze,



Thanks for your response. What you've suggested is at the browser level and will be just for you and not for all the users. My use case is for a certain app and a particular requirement.


Use the below statement in your UI page.



g_form.modified=false;


Interesting but it doesn't work in the UI policy due to VA restrictions in the SP.