Problem with alert on page redirect or reload


I’m having a problem with one of my pages where if I navigate away from the page, or reload the page, then I get an alert message asking for confirmation of the navigation or reload. we have another page that is similar to this where we don’t have that problem, nor do we have this problem in our staging or production environments. I compared the pages side by side and there’s while there are some differences (JavaScript), there’s nothing configuration wise that I can see that would cause problems.

That said, we did move some JavaScript into a static resource, could this be a cause?

Any insight would be helpful. Thanks!

Generally the issue here is that somehow your page processes are creating model changes.  This could be a new row made on page load,  or some data change…  Then in your model you have the “Prevent users from leaving page…” (advanced tab) property selected. 

The trickiest situations occur with page includes.  They don’t show up in your initial review of models,  but once the included page gets called,  all its models are in the page and will fire that unsaved changes warning… 

Happy sleuthing. 

I finally found the problem. Someone put in a window.onbeforeunload in a in a static resource that I was unaware of. Thanks for the reply.  

Hi Rob,

 Is there anyway to turn off ‘Prevent users from leaving page’ globally? Since the latest update it’s really tanking us now that we have to go to every page and every model and turn it off.