X
Tap here to go to the mobile version of the site.
Your Firefox is out of date and may contain a security risk! Upgrade Firefox

Support Forum

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

Posted

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

Thanks

Chosen solution

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.)

Read this answer in context 3

Additional System Details

Installed Plug-ins

  • Google Update
  • Shockwave Flash 11.7 r700
  • IE Tab 2 Plug-in for Mozilla/Firefox
  • Adobe PDF Plug-In For Firefox and Netscape 11.0.0

Application

  • User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0

More Information

Leo McArdle 10 solutions 38 answers

Chosen Solution

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.)

Question owner

Thnx Leo

Purebeads 0 solutions 17 answers

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.

cor-el
  • Top 10 Contributor
  • Moderator
10753 solutions 96760 answers

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);
jscher2000
  • Top 10 Contributor
2365 solutions 20922 answers

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.

Purebeads 0 solutions 17 answers

Thanks for trying to help.

jscher2000
  • Top 10 Contributor
2365 solutions 20922 answers

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.