Is it possible to disable Javascript without reloading the page in modern Firefox?

5

1

I seem to remember that, in the past, when one disabled Javascript in Firefox, it would immediately stop all previous-loaded scripts and event handlers from running.

However, I am now running Firefox 51 on Ubuntu Linux, and I discovered that setting javascript.enabled to false in about:config still allows already-running scripts to run until the next page refresh.

Is there some mechanism to disable Javascript immediately without reloading the page in modern Firefox?

merlin2011

Posted 2017-05-02T07:39:33.207

Reputation: 1 409

Use an older version of Firefox and maybe try to verify the behavior beforehand? Why do you have this requirement? – Seth – 2017-05-02T09:19:08.453

2@Seth, I just want to read the rendered content without executing event handlers on every click and mouse over event. Also, the site constantly make Ajax requests as well, which I find wasteful if I'm just trying to read the contents. Unfortunately the initial rendering requires js, so disable after refresh is not an option. – merlin2011 – 2017-05-02T10:10:49.987

Answers

5

You can simply go to your dev-tools, in the Debugger Panel, and then click the Pause button || or press F8 :

Screencast of the dev-tools
(screenscast from FF54 on osX)

This will immediately stop all execution of javascript in the current page.

Kaiido

Posted 2017-05-02T07:39:33.207

Reputation: 151

1This makes the rest of the page non usable. – merlin2011 – 2017-05-06T04:25:34.877

2That is, I can't scroll the page or do anything else. – merlin2011 – 2017-05-06T04:25:57.477

@merlin2011 This should not disable scrolling on the page, but other features like mouse events (even on CSS) will be blocked too. But you should have a complete access of the current DOM through the js console. – Kaiido – 2017-05-06T04:35:50.000

I'm trying to use the page as an ordinary user, as if the current page was simply a static page instead of one rendered by js. – merlin2011 – 2017-05-06T04:46:00.827

@merlin2011, then var blob = new Blob([new XMLSerializer().serializeToString(document.documentElement)]); window.open(URL.createObjectURL(blob)); once the page has loaded, and in dev-tools preferences of the opened pop-up check "Disable JavaScript". But I don't understand why you would need to try a page without js when js is needed to render the page... – Kaiido – 2017-05-06T05:13:05.927