Page 1 of 1

Stop pages from nagging the user when closing them

Posted: Sun Nov 17, 2013 3:53 pm
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.

Re: Stop pages from nagging the user when closing them

Posted: Sun Nov 17, 2013 5:11 pm
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?

Re: Stop pages from nagging the user when closing them

Posted: Sun Nov 17, 2013 5:19 pm
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.

Re: Stop pages from nagging the user when closing them

Posted: Sun Nov 17, 2013 6:01 pm
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.

Re: Stop pages from nagging the user when closing them

Posted: Sun Nov 17, 2013 8:20 pm
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?://

Re: Stop pages from nagging the user when closing them

Posted: Sun Nov 17, 2013 8:44 pm
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.

Re: Stop pages from nagging the user when closing them

Posted: Mon Nov 18, 2013 12:24 am
by Thrawn
But be careful where you use it, because it's sometimes legitimate (eg you're halfway through composing an email).

Re: Stop pages from nagging the user when closing them

Posted: Mon Nov 18, 2013 1:23 pm
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! ;)

Re: Stop pages from nagging the user when closing them

Posted: Thu Jul 03, 2014 10:22 pm
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.

Re: Stop pages from nagging the user when closing them

Posted: Fri Jul 04, 2014 2:12 pm
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);