How to disable JavaScript navigation for a domain?
How to disable JavaScript navigation for a domain?
YouTube has recently introduced a damned annoying "feature" - when you're viewing a playlist, it immediately navigates to the next video when the current video ends. There doesn't seem to be any setting to stop this.
I think the easiest way to stop it would be to disable all JavaScript navigation on youtube.com, or preferably display a yes/no prompt each time it tries. Is there a way to do this with NoScript? If not, I think it would be a good addition. I want to continue allowing all other JavaScript, so I have set NoScript to allow scripts globally, and it doesn't stop YouTube from JS-navigating away from the page.
I think the easiest way to stop it would be to disable all JavaScript navigation on youtube.com, or preferably display a yes/no prompt each time it tries. Is there a way to do this with NoScript? If not, I think it would be a good addition. I want to continue allowing all other JavaScript, so I have set NoScript to allow scripts globally, and it doesn't stop YouTube from JS-navigating away from the page.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0 SeaMonkey/2.31
Re: How to disable JavaScript navigation for a domain?
URL: https://www.youtube.com/watch?v=toHlMD5 ... jPbNs2M6Yo
Oh, it looks like they've removed it?> when you're viewing a playlist, it immediately navigates to the next video when the current video ends
I believe that "squiggly"-like icon is supposed to control that?
(I find it a PITA too cause I typically don't want it enabled, but am never sure in what state it is?)
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows NT 5.1; rv:34.0) Gecko/20100101 SeaMonkey/2.31
Re: How to disable JavaScript navigation for a domain?
I think you will need to use a surrogate script to do what you want.
Would the following work for you? WARNING: UNTESTED
This would pop up a confirmation dialog *every time* you try (or the page tries) to leave a video page on YouTube, so it might be annoying...
I block so much on YouTube that I can't test this myself, sorry.
Would the following work for you? WARNING: UNTESTED
Code: Select all
noscript.surrogate.confirm_yt_exit.replacement : if (window.top.location.hostname == 'www.youtube.com') { window.addEventListener('beforeUnload', function(e){return 'Llllllll';}, false); }
noscript.surrogate.confirm_yt_exit.sources : @.youtube.com/watch?*I block so much on YouTube that I can't test this myself, sorry.
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.60 Safari/537.17
Re: How to disable JavaScript navigation for a domain?
Is there no way to detect whether it's JavaScript that's caused the navigation, as opposed to your manually changing the URL?barbaz wrote:I think you will need to use a surrogate script to do what you want.
Would the following work for you? WARNING: UNTESTEDThis would pop up a confirmation dialog *every time* you try (or the page tries) to leave a video page on YouTube, so it might be annoying...Code: Select all
noscript.surrogate.confirm_yt_exit.replacement : if (window.top.location.hostname == 'www.youtube.com') { window.addEventListener('beforeUnload', function(e){return 'Llllllll';}, false); } noscript.surrogate.confirm_yt_exit.sources : @.youtube.com/watch?*
I block so much on YouTube that I can't test this myself, sorry.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0 SeaMonkey/2.31
Re: How to disable JavaScript navigation for a domain?
Well there are a number of different ways for JS to change the location, including but not limited to the following
Code: Select all
window.location.href = 'https://noscript.net/';Code: Select all
document.getElementsByTagName('a')[0].click();Code: Select all
document.location.href='https://noscript.net/';*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.60 Safari/537.17
Re: How to disable JavaScript navigation for a domain?
True, but it would be nice if the browser provided some kind of general "JS caused this navigation" flag.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0 SeaMonkey/2.31
Re: How to disable JavaScript navigation for a domain?
Nice but probably not technically possible (note the second one is actually just clicking on a link, which is a normal thing for a user to do)jez9999 wrote:True, but it would be nice if the browser provided some kind of general "JS caused this navigation" flag.
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.60 Safari/537.17
Re: How to disable JavaScript navigation for a domain?
Sure, but the browser knows whether it's been triggered by JS or a user clicking.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0 SeaMonkey/2.31
Re: How to disable JavaScript navigation for a domain?
I did a quick Internet search about how to check if firefox browser location was changed by javascript, and couldn't find anything on the subject...
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.60 Safari/537.17
Re: How to disable JavaScript navigation for a domain?
Probably a more practical, but still complex solution would be to find the piece of script that is actually performing the unwanted behavior, and write a surrogate that specifically targets it.
======
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.
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:34.0) Gecko/20100101 Firefox/34.0