Stop pages from nagging the user when closing them

Bug reports and enhancement requests
Post Reply
bgmnt
Junior Member
Posts: 47
Joined: Sun Nov 17, 2013 3:41 pm

Stop pages from nagging the user when closing them

Post by bgmnt »

Hey,

did a quick search, couldn't find a similar feature request.
Some pages think it's OK to throw a warning/confirmation dialog in your face when you try to close them:
Image
Could we please get an option to eliminate this nonsense on whitelisted pages once and for all? I tried a couple of Greasemonkey scripts that advertise exactly this but they didn't work.
teevox.com does this for example.

Cheers.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0
barbaz
Senior Member
Posts: 10847
Joined: Sat Aug 03, 2013 5:45 pm

Re: Stop pages from nagging the user when closing them

Post by barbaz »

Wow. Didn't know webpages could do that. I don't like it either.
Try creating the following two string preferences in about:config

Code: Select all

noscript.surrogate.antiexitblock.replacement : window.onbeforeunload = function() {};
noscript.surrogate.antiexitblock.sources : @^https?://
Does that work?
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:25.0) Gecko/20100101 Firefox/25.0 SeaMonkey/2.22
bgmnt
Junior Member
Posts: 47
Joined: Sun Nov 17, 2013 3:41 pm

Re: Stop pages from nagging the user when closing them

Post by bgmnt »

Hi, thanks for the suggestion. Unfortunately it doesn't work, I still get the prompt.

/e: That's also what one of the Greasemonkey scripts tried to do.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0
barbaz
Senior Member
Posts: 10847
Joined: Sat Aug 03, 2013 5:45 pm

Re: Stop pages from nagging the user when closing them

Post by barbaz »

OK, went to teevox.com to check this out. Could they be sending the alert through Flash? Because if I don't allow the Flash plugin (through SeaMonkey click-to-play) I don't get the page leaving confirmation...

Anyway, if bypassing these confirmations is within the scope of NoScript, +1 to this request. Dialogs of such an intrusive nature should be fully controllable by the user.
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:25.0) Gecko/20100101 Firefox/25.0 SeaMonkey/2.22
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: Stop pages from nagging the user when closing them

Post by Giorgio Maone »

Try this surrogate.

noscript.surrogate.noflashexit.replacement:

Code: Select all

window.addEventListener("load", function() window.onbeforeunload=function(){for(let o of document.querySelectorAll("object,embed"))o.parentNode.removeChild(o);}, false)
noscript.surrogate.noflashexit.sources:

Code: Select all

@^https?://
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
barbaz
Senior Member
Posts: 10847
Joined: Sat Aug 03, 2013 5:45 pm

Re: Stop pages from nagging the user when closing them

Post by barbaz »

Giorgio Maone wrote:Try this surrogate.

noscript.surrogate.noflashexit.replacement:

Code: Select all

window.addEventListener("load", function() window.onbeforeunload=function(){for(let o of document.querySelectorAll("object,embed"))o.parentNode.removeChild(o);}, false)
noscript.surrogate.noflashexit.sources:

Code: Select all

@^https?://
That worked! Thanks Giorgio.
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:25.0) Gecko/20100101 Firefox/25.0 SeaMonkey/2.22
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: Stop pages from nagging the user when closing them

Post by Thrawn »

But be careful where you use it, because it's sometimes legitimate (eg you're halfway through composing an email).
======
Thrawn
------------
Religion is not the opium of the masses. Daily life is the opium of the masses.

True religion, which dares to acknowledge death and challenge the way we live, is an attempt to wake up.
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0
bgmnt
Junior Member
Posts: 47
Joined: Sun Nov 17, 2013 3:41 pm

Re: Stop pages from nagging the user when closing them

Post by bgmnt »

Giorgio Maone wrote:Try this surrogate.

noscript.surrogate.noflashexit.replacement:

Code: Select all

window.addEventListener("load", function() window.onbeforeunload=function(){for(let o of document.querySelectorAll("object,embed"))o.parentNode.removeChild(o);}, false)
noscript.surrogate.noflashexit.sources:

Code: Select all

@^https?://
Awesome, thank you! ;)
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0
barbaz
Senior Member
Posts: 10847
Joined: Sat Aug 03, 2013 5:45 pm

Re: Stop pages from nagging the user when closing them

Post by barbaz »

Above surrogate does not prevent the page close confirmation dialog on http://www.mixcloud.com/deeppressuremus ... -mixes-04/
I'm unable to figure this one out at all. Any help would be appreciated.
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:30.0) Gecko/20100101 Firefox/30.0 SeaMonkey/2.27a2
barbaz
Senior Member
Posts: 10847
Joined: Sat Aug 03, 2013 5:45 pm

Re: Stop pages from nagging the user when closing them

Post by barbaz »

never mind, figured it out thanks to discovering an extra Firebug feature which I didn't know existed.

Code: Select all

window.addEventListener("beforeunload", function(e){e.stopImmediatePropagation();for(let o of document.querySelectorAll("object,embed"))o.parentNode.removeChild(o);}, false);window.addEventListener("load", function(){window.onbeforeunload=function(){}},false);
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:30.0) Gecko/20100101 Firefox/30.0 SeaMonkey/2.27a2
Post Reply