Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

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

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!

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.

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.