How to stop scripts on a page?

I have a random webpage open in my Chrome. I open it with javascript enabled, as I need some scripts that need to be executed.

Than from some point I want to stop the script, so no timers or event handlers need to be run. Codes using an infinite loop are not suitable as I want the page to be responsive.

How can i achieve this?

The following code partially fulfills what I need

document.body.outerHTML = document.body.outerHTML
for(t=setTimeout(()=>{}); t; --t) clearTimeout(t)

and

  • documentAjax event listeners on and callbacks will survive
  • This leads to html parsing, so incorrect markup can be changed by parsing

I also hope that there is some way to do this through devtools without actually interacting with the page code.

PS: , .

+4
1

/ JavaScript , DevTools. Cmd + Shift + P (Mac) Ctrl + Shift + P (Windows/Linux).

Disable JavaScript Enter, script.

500 . JavaScript , .

Disable

JavaScript, " JavaScript" Enter. , , .

Paused

. , JavaScript, . , .

+5

Source: https://habr.com/ru/post/1671079/


All Articles