31

How can I stop scripts on a page in Firefox? I don't care if the solution is draconian. Super-tech-savvy solutions are also fine.

Clarification: I don't want to turn off scripts permanently. I want to be able to kill a script (or all active scripts) on-demand for a given web page.

5
  • 3
    noscript.net Mar 7, 2017 at 14:46
  • 3
    Pressing ESC stops script execution.
    – simlev
    Mar 7, 2017 at 14:53
  • Pause, abort or disable? If you want to temporarily enable JS you should use NoScript.
    – Oskar Skog
    Mar 7, 2017 at 16:10
  • 8
    Pressing ESC WILL NOT stop ReactJS from executing.
    – user530079
    Feb 20, 2018 at 13:32
  • 3
    @simlev Pressing ESC does NOT stop script execution.
    – LonnieBest
    Oct 7, 2020 at 4:55

5 Answers 5

18

It's been answered on a later question. For short:

  • Open the developer console from the menu or by F12.
  • Click the debugger tab.
  • Click the pause button.
3
  • 2
    Doesn't work when the script enters an infinite loop which is what I want to stop (or if it works, then with a lot of delay). Oct 31, 2020 at 12:06
  • Or directly hit the F8 button ;-) Jun 25, 2023 at 5:48
  • What does F8 do?
    – ORcoder
    Jan 28 at 2:46
3

Firefox developer console has a ⏸ pause button and a Disable JavaScript setting, which is very effective:

Firefox Developer Console

  • In case you don't want any JavaScript to run, first disable it then refresh page (F5).
  • In case you want it to run just until a given point, use the ⏸ pause button in the debugger tab.

You can open the developer console for a given page form the menu, with F12, or with one of this shortcut combinations: Shit + Ctrl/ + K/I

1
  • I found this answer the best for simply disabling Javascript on a particular page. Had to open the little cog in the top right of the Debugger tab to find the option.
    – dain
    Aug 4, 2023 at 17:43
2

Firefox provides a method for disabling JavaScript within its configuration settings. You can put about:config in the address bar where you would normally place the URL for a page you wished to visit. You will see a warning stating "Changing these advanced settings can be harmful to the stability, security, and performance of this application. You should only continue if you are sure of what you are doing." Click on the "I'll be careful, I promise!" button. Look for the javascript.enabled setting; when you've found it double-click on it to toggle the setting from enabled to disabled. Or you can right-click on the setting and choose "Toggle". But that will enable/disable JavaScript for all sites and all pages, so you would have to disable JavaScript before visiting the page and re-enable it afterwards. For finer-grained control at the domain and page level, you can install the NoScript extension for Firefox.

Another option is the PrefBar add-on to add a button for toggling JavaScript off and on for the current tab. The developer's home page is at PrefBar.

2

Pressing ESC worked for me as suggested by @simlev. For me, it was a page where a blocking pop-over would be displayed in 5-10 seconds after the page was loaded. Pressing ESC effectively stopped the JavaScript on that page. This wouldn't be a replacement for extensions like NoScript, but could be handy in similar situations.

Update on 10/2020: Given the multiple comments about how pressing ESC does not work, one should not have much hope with this method. As stated before, this worked only for a specific case; however, I guess it does not hurt to try just to see if works for you - without much expectation.

4
  • 3
    This does not work. Sites still show up with high CPU usage in about:performance after after pressing ESC
    – JKAbrams
    Jun 2, 2019 at 17:18
  • Well, this was not an absolute definite answer but merely 'one' possible answer that worked for me and obviously for some others. Clearly, the answer will depend on many factors, such as browser, JS framework etc.
    – dojuba
    Jun 4, 2019 at 8:02
  • In my case, ESC stops the loading of page but not the execution of JS. Aug 25, 2020 at 19:47
  • 1
    I didn't think much clarification would be needed, but the tone of some comments says otherwise. Pressing ESC stops page loading, as @JoseManuelAbarcaRodríguez correctly explains: if you time it right after the page contents are displayed but before the unwanted scripts are loaded, you effectively prevent them from running. This can be useful in some scenarios and is IMHO relevant to the question.
    – simlev
    Oct 8, 2020 at 8:31
0

The only way I could stop an infinite loop in the Firefox Developer Console while preserving the rest of my Firefox/tabs was to kill the CPU-intensive process in my Task Manager/System Monitor.

You must log in to answer this question.

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