Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uBlock Origin doesn’t honor noscript tags when blocking JS #308

Closed
linkmauve opened this issue Jun 7, 2015 · 8 comments
Closed

uBlock Origin doesn’t honor noscript tags when blocking JS #308

linkmauve opened this issue Jun 7, 2015 · 8 comments

Comments

@linkmauve
Copy link

In advanced mode, when blocking some or all of the JS scripts on a page, the noscript tag following the script tag is never used.

Here is a simple testcase for this issue, the page should display either “Using <script/>” when using JS, or “Using <noscript/>” when blocking it, but it currently displays nothing when using uBlock Origin.

http://linkmauve.fr/files/ublock.xhtml

@gorhill
Copy link
Owner

gorhill commented Jun 7, 2015

There is no good solution for this.

uBlock does not disable javascript in the browser, it prevents it from running using a Content-Security-Policy header, and in such case it appears the browser does not fall back on noscript tags. Forcing the noscript tags to render using some trickery leads to other issues.

So there is no good solution. Maybe file an issue with the browser devs to ask them if the noscript tags can become active whenever the browser can't execute script tags, for whatever reasons, not just just because javascript is disabled in the browser.

@luxoflux
Copy link

luxoflux commented Jun 7, 2015

So those annoying <noscript><meta http-equiv="refresh" content="0" url=...></noscript> redirects don't function now? I hadn't noticed when that changed, but I'm glad.

@gitarra
Copy link

gitarra commented Jun 7, 2015

Just for the record, e.g. NoScript honours noscript tags. NoScript also has options whether to allow META redirections inside them or to hide them completely.

@vn971
Copy link

vn971 commented Jun 21, 2017

Can we maybe use this technique?: http://kb.mozillazine.org/Allowing_only_certain_sites_to_use_JavaScript

That is, if all javascript is disabled for a site, can we set
user_pref("capability.policy.nojs.sites", "http://www.example.com http://www.example.net");
?

This probably has to be carefully thought of as uMatrix can both function as a blacklist and as a whitelist, but still, even supporting the simplest most popular scenario would be awesome.

@chiraag-nataraj
Copy link

I just ran into this when trying to ensure my site was accessible to users who don't have javascript. Do we know how NoScript manages to deal with the <noscript> tag and can we do something similar?

@bzbarsky
Copy link

Gecko bug https://bugzilla.mozilla.org/show_bug.cgi?id=1392090 will make this work for "script-src 'none'" once fixed. For cases when some but not all scripts are blocked, the desired behavior of noscript tags is ... unclear at best.

@gorhill
Copy link
Owner

gorhill commented Nov 15, 2017

will make this work for script-src 'none' once fixed

Ok thanks. Well, a master javascript switch was an alternative solution, however it could not be implemented in Firefox due to browser.contentSettings not being present.

Between both solutions, I like the script-src 'none' far better, because this matches exactly uBO's way of deciding on the fly as to whether something is blocked or not, while this is not possible with the essentially declarative chrome.contentSettings API.

@gorhill
Copy link
Owner

gorhill commented Aug 31, 2018

A new per-site switch has been added to wholly disable/enable javascript. noscript tags will be honoured if and only if javascript is wholly disabled through that new per-site switch.

hawkeye116477 added a commit to hawkeye116477/uBlock-for-firefox-legacy that referenced this issue Oct 8, 2020
…es#155

<gorhill#95>: a new per-site switch
has been added, no-scripting, which purpose is to wholly disable/enable
javascript for a given site. This new switch has precedence over all
other ways javascript can be disabled, including precedence over dynamic
filtering rules.

The popup panel will report the number of script resources which have
been seen by uBO for the current page. There is a minor inaccuracy to
be fixed regarding the count, and which fix requires to extend request
journaling.

<gorhill/uBlock#308>: the `noscript` tags will
now be respected when the new no-scripting switch is in effect on a given
site.

A default setting has been added to the _Settings_ pane to
disable/enable globally the new no-script switch, such that one can
work in default-deny mode regarding javascript execution.

<uBlockOrigin/uBlock-issues#155>: a new
hidden setting, `requestJournalProcessPeriod`, has been added to
allow controlling the delay before uBO internally process it's
network request journal queue. Default to 1000 (milliseconds).

Co-authored-by:  gorhill <585534+gorhill@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants