Search Support

Beware of phishing attacks: Mozilla will never ask you to call a number or visit a non-Mozilla website. Please ignore such requests.

Learn More

Is there a possibility to prevent "This page is asking you to confirm that you want to leave..." popup message using JavaScript?

  • 2 replies
  • 1 has this problem
  • 24 views
  • Last reply by jscher2000

more options

HI! Could you tell me please how can I prevent this popup message? Is there some browser vendor supported way to do it using JavaScript or we have just only possibility to do it by editing Firefox browser setting 'dom.disable_beforeunload = true' on each browser client? As an app developer I need to disable this notification popup for all users at once. Thanks!

All Replies (2)

more options

It is the web page doing this, so if you have control over the web page then modify its content. You can use a autoconfig.cfg file to force the pref to false for all users if this is about Firefox in a company environment.

I don't know if you can overtake the onbeforeunload handler via JavaScript (WebExtension) and replace it with an empty NOP function.

Try to ask advice at the Stack Overflow or Reddit forum website.

Helpful?

more options

aleksandr.chebaev said

As an app developer I need to disable this notification popup for all users at once.

I'm puzzled by that statement. If you are the web app developer, and you don't want to hook the beforeunload event, and you don't know why it is happening, that's concerning. Are you using frameworks or libraries that might not want a user to leave the page to avoid loss of unsaved data while editing or progressing through a transaction? It's got to be somewhere.

Helpful?

Ask a question

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.