disable-javascript icon indicating copy to clipboard operation
disable-javascript copied to clipboard

does not work for file: urls

Open bughit opened this issue 7 years ago • 2 comments
trafficstars

DJ 2.3.1 Fx 62.0.3

javascript is not disabled, in either domain or tab mode

bughit avatar Oct 16 '18 18:10 bughit

Hi @bughit

Thanks for your report! The web extension indeed doesn't work for local files opened directly from the file system. And unfortunately it won't be possible to disable JS for them.

The web extension API is quite strict about what's possible and not (compared to the legacy XUL based extensions) meaning that there's no API for disabling/enabling JS at this time. My web extension uses Content-Security-Policy headers to enable/disable JavaScript - while this works for normal sites, it won't work for local files.

However, I see some room for improvement here:

  1. Clearly state in the web extension description that local files are not supported
  2. Disable the toggle switch if a local file was opened

If you want to disable JavaScript for local files, I'm afraid you'll have to install a local web server and access them through localhost.

I hope you understand!

dpacassi avatar Oct 18 '18 08:10 dpacassi

Alternatively, you could use the meta tag for this, cf. https://developers.google.com/web/fundamentals/security/csp/#the_meta_tag.

gildas-lormeau avatar Jan 06 '19 15:01 gildas-lormeau