6
2
i'm looking for a conclusive, 100%-effective way to block this latest hideous trend of marketers and scammers alike. you'll be familiar with it yourself - it's a very easy way to tell whether or not to trust a website if it flags up a warning like this when you try and navigate away:
i'm aware some sites use this benevolently - even superuser does it when attempting to close the browser - but i hate it. if i close a tab it's because i want it closed. i do NOT appreciate my browser second-guessing my choices. if there is a way to kill this, i expect it to kill superuser's implementation of it as well.
there are more than a few userscripts that aim to kill this, and i'll post them here. all of them refuse to work with a certain link, which i'll also post, which renders them moot immediately.
https://userscripts.org/scripts/show/98260
https://userscripts.org/scripts/show/187713
here's the site that somehow manages to overcome any protection against it:
http://as.sexad.net/as/pu?p=adc
(PLEASE NOTE: this is a dangerous site! do NOT visit it if you are not protected with an anti-virus, if you're running an obsolete web browser, if you have java installed, etc., etc. it WILL attempt to mislead you. also, be aware it has a penchant for playing awful music immediately upon loading at full volume so best to put the mute on.)
the above site will either load something about free sex videos or, more often, a video sharing site trying to be youtube. this evades any "block onunload" script i throw at it. you can also try posting a reply to this topic (i tried commenting, but that didn't cause the dialogue, so try answering, which i can't yet) and then closing your browser - superuser do the same thing, for their sins.
thanks for any suggestions. let's kill this user-hostile nonsense for good.
1I hope all web browser makers allow users to control which sites can show the alert() and "are you sure to leave" as modal popup. These just leave spammers great ways to exploit users. Not only spammers, but dumb web developers in my country excessively use alert() for stupid things like "You are logged in." – Damn Vegetables – 2015-01-15T22:30:48.140
I am also looking for an easy way to block those messages in Chrome since I only know a fix for Firefox (go to about:config and set dom.disable_beforeunload = true, reboot Firefox and all cool).....grmpf. – nerdess – 2015-04-23T22:06:43.673
You could whitelist javascript for only those sites you want it to run on, which would essentially solve this problem. – Paul – 2014-02-15T22:07:03.843
whitelisting javascript strikes me as an incredibly overreaching solution to tackle one annoyance. i shouldn't have to alter my entire browsing experience to accommodate some injurious design decisions. – seagull – 2014-02-15T22:09:08.653
You are actually describing two annoyances. One is a straightforward "onunload", which can be countered with the userscript you provide. The other is "what if that doesn't work". Nefarious sites will use a range of techniques to subvert control of your browser. You may find an approach with the site example provided, but that doesn't mean it will work with the next site that obfuscates its methods. Whitelisting javascript managers generally involve a one-click per site you frequent, so it is quick to get back to where you were beforehand, but now with protection. – Paul – 2014-02-15T22:30:35.867
i really don't want to go down the route of "guilty until proven innocent", but it's certainly something to consider. thanks. – seagull – 2014-02-15T22:32:44.787
You can consider blocking spammy sites altogether by making an entry in your HOSTS file (assuming you're using Windows). The file is typically at this path - C:\Windows\System32\drivers\etc. Open the hosts file with administrative privileges & make an entry for the offending site like this - 127.0.0.1 unwanted.domain – mvark – 2014-02-16T04:26:51.507
the issue is that i don't know sites are going to pull this BS until after i've visited them. again, it's a too-far overreaching solution. – seagull – 2014-02-16T10:46:05.080