fibono
fibono

Reputation: 783

How to disable "Changes you made may not be saved." dialog box (Chrome)?

A similar question has been answered (Disable "Changes you made may not be saved" pop-up window), but somehow this still does not work for me.

I'm attempting to disable the Changes you made may not be saved. dialog box on form input changes. I know Chrome has removed the custom message capability, but I am having difficulty disabling the box altogether. I have the following javascript at the bottom of some HTML code:

  window.onbeforeunload = function() {
  };

  window.onbeforeunload = null;

Neither of the two work for me. When I type window.onbeforeunload into the inspector console, I get a null return value. Can the window.onbeforeunload = null; be called anywhere within the lifespan of the page? Perhaps I'm misplacing it somewhere?

Upvotes: 5

Views: 13853

Answers (1)

Vijay Sasvadiya
Vijay Sasvadiya

Reputation: 414

If you are using jQuery then below code will work for you

$(window).off('beforeunload');

Upvotes: 1

Related Questions