Is it possible to kill all scripts on a webpage after loading the page in Firefox?

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?


Solution 1:

  • 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