cancel
Showing results for 
Search instead for 
Did you mean: 

how can i disable the message "leave page / stay on page"

SOLVED
Highlighted
New User

how can i disable the message "leave page / stay on page"

How can i disable the message "leave page / stay on page" please explain step by step if if it involved inserting java script.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Regular User

Re: how can i disable the message "leave page / stay on page"

Installing this Greasemonkey script should help: https://userscripts.org/scripts/show/23865

(Be aware that this could break some sites, and isn't approved/vetted by Mozilla in any way shape or form.)

7 REPLIES
Regular User

Re: how can i disable the message "leave page / stay on page"

Installing this Greasemonkey script should help: https://userscripts.org/scripts/show/23865

(Be aware that this could break some sites, and isn't approved/vetted by Mozilla in any way shape or form.)

New User

Re: how can i disable the message "leave page / stay on page"

Thnx Leo

New User

Re: how can i disable the message "leave page / stay on page"

Isn't there a way to disable the prompt in Firefox's configuration? I don't want to add a script to Firefox that might "break" some pages.

Site Moderator

Re: how can i disable the message "leave page / stay on page"

You could consider to use a bookmarklet to disable those events if it happens in specific condition and only on some known web pages.

  • javascript:void(window.onbeforeunload = null);void(window.onunload = null);
SUMO Contributor

Re: how can i disable the message "leave page / stay on page"

Allowing pages to watch for and respond to those two standard JavaScript events (unload, beforeunload) can be useful in some cases. For example, a site where you are editing a post or message can remind you that you're about to lose some work when you want to leave the page.

But yes, some sites do abuse these events to try to trap you into doing something...

I'm not aware of any built-in setting that will disable pages from watching for and responding to those two standard JavaScript events (unload, beforeunload).

The NoScript extension will block ALL scripts from running on a site, but you do have to train it to trust sites you use where you DO want scripts to run, so this may be too much hassle if you only want to use it for this one purpose. (Coincidentally, it blocks a lot of ads and tracking scripts, so it has other attractions.)

Wish I could think of something better.

New User

Re: how can i disable the message "leave page / stay on page"

Thanks for trying to help.

SUMO Contributor

Re: how can i disable the message "leave page / stay on page"

These three userscripts are along the same lines as the one link to above:

None of the four scripts has any mechanism for site exceptions built into it, but you can make exceptions using Greasemonkey's user settings tab. You do that using the script's Options dialog. You can do that from the Add-ons page, User Scripts category. Either:

  • Monkey toolbar button > Manage User Scripts
  • Ctrl+Shift+a (Mac: Command+Alt+a) > User Scripts
  • orange Firefox button (or Tools menu) > Add-ons > User Scripts

Then click the Options button for the relevant script. On the User Settings tab, in the Excluded Pages box, you can enter the site that you want to carve out of the script. Note that in order to match all pages on the site, you need to use the wildcard character (*) as shown in the attached screen shot.

2013-12-26-21-30-31-56e801.png