dpacassi / disable-javascript

Adds the ability to disable JavaScript on specific sites.
MIT License
275 stars 35 forks source link

[Feature Request] Add an option to disable JavaScript without refreshing the page #98

Open flarn2006 opened 2 years ago

flarn2006 commented 2 years ago

I just installed the extension and so far I haven't needed this feature, but I know I'm probably going to at some point. It would be nice to be able to disable JavaScript on a page that's already loaded. This way, if a page requires JavaScript in order for the content to load, I'll be able to keep the scripts running long enough to do that, but kill them before they do something I don't want, such as replacing the text of the article I'm reading with a paywall. What I'm looking for is, essentially, a way to tell the browser to keep the DOM exactly as it is at that moment, and not let any further changes happen until I refresh.

Minabsapi commented 2 years ago

Second this. This is mostly the feature I'm looking for, I'm fine with JavaScript running at page rendering but I don't want it to continue and waste memory after that

Edit: Upon a quick glance at the source code, it seems this extension, like basically every similar one on the addon store, just re-sends the request with a header appended and some additional tricks to get a new page without JavaScript. So we can't get rid of the refresh since it's here by design Most of people like me who installed this addon with that feature in mind may have thought it could directly disable it, nuking the scripts and stopping the engine, but we've clearly been misguided. It could have been possible when Firefox used to accept addons that were interacting more directly with the browser, but now thanks to the ""security"" oriented mindset thinking every user is an idiot who has no idea what they're installing it is no longer possible and we're reduced to use glorified webpages interacting with a poor API leaving no freedom to attackers indeed, but also to advanced developers. Good job, Firefox team.

daveloyall commented 2 years ago

I came here to request this feature.

After reading Minabsapi's comment, I'd like to specify the functionality I am looking for... maybe there is some way to obtain it, since it may be more limited than fully disabling javascript.

The primary reason I want to disable javascript at any time is to prevent webpages from doing things in response to something I do. That is, some web pages have javascript functions that are triggered "on event".

Example 1: I type my valid email address into a form and some javascript is fired on the keypress event (or the submit event) which incorrectly evaluates that my email address is not valid. (My address has hyphens in the domain part, which some web developers do no realize is valid.) Sometimes if I use Developer Tools to disable the event, I can successfully use the website (because the broken code was client-side only; the server-side code was less broken). Suppose that the rest of the form needs javascript to render properly: then a page refresh after disabling javascript will not achieve my goal.

Example 2: I scroll on a page and some "sticky" floating div appears. A page refresh after disabling javascript might achieve my goal, unless rendering the rest of the page requires javascript.

Example 3: I right click on a page, or attempt to paste, or attempt to select text to copy, etc, and the javascript on the webpage says no. (UGH!! :)) Again, a page refresh after disabling javascript might achieve my goal, unless rendering the rest of the page requires javascript.

I hope this helps someone somehow!