2

Is it possible to disable all scripts on a website after a certain time? For example, I would like to load a webpage and have it load executing whatever scripts it wants. However, I would like to disable all scripts from running after the page loads manually. Now, I can bring up the inspect and debugger screen and pause script execution, but that does not allow me to look at the webpage without scripts running. It grays out the webpage. Is there a way to actually copy text from the webpage while also pausing/disabling all scripts?

2 Answers 2

2
  • Enable the command line of the Browser Console (it is disabled by default)
  • Load the webpage
  • Open the Browser Console, type or copy and paste the following line and press Enter
gBrowser.selectedBrowser.browsingContext.allowJavascript = false;

The setting is tab-specific, and persists navigation. You can always set JavaScript on again, by applying true

Also, since this is not documented it can change anytime. In fact it changed recently, and this code will work only with Firefox 92 and onwards

0

Chrome has the javascript Switch, you just wait for the page the load then turn off javascript: https://chrome.google.com/webstore/detail/toggle-javascript/cidlcjdalomndpeagkjpnefhljffbnlo

Firefox has Javascript Switcher with pretty much the same functionality but remembers the last position you left it in per site: https://addons.mozilla.org/en-US/firefox/addon/quick-js-switcher/?utm_source=addons.mozilla.org&utm_medium=referral&utm_content=search

4
  • The addon does not allow for disabling JavaScript without reloading the page as far as I understand.
    – Viktor
    Oct 21, 2021 at 18:28
  • Sorry, the Chrome one does.
    – 8vtwo
    Oct 21, 2021 at 21:19
  • @Viktor try addons.mozilla.org/en-US/firefox/addon/javascript-control/… it has the same icon as the chrome version so I assume it works the same and wont reload
    – 8vtwo
    Oct 21, 2021 at 21:25
  • @8vtwo unfortunately that Firefox addon also reloads after disabling JavaScript.
    – Sean
    Jun 1, 2023 at 10:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .