Victor2748
Victor2748

Reputation: 4199

How to pause JavaScript after page done loading?

I am loading an HTML page in my browser from a web site. As far as I understand, the browser loads the page first, then starts executing the JavaScript code on it.

Question: How can I pause the JavaScript execution in Google Chrome as soon as the page is done loading, and then start it after, manually?

What I am trying to achieve is to load the page in a browser (any browser, but preferably Google Chrome), but edit the javascript code before it starts executing.

Upvotes: 0

Views: 2965

Answers (2)

Aweary
Aweary

Reputation: 2312

Check out Debugging Javascript in Chrome. You can set breakpoints at the beginning of any JS file and then continue from there.

Debugging with breakpoints

A breakpoint is an intentional stopping or pausing place in a script. Use breakpoints in DevTools to debug JavaScript code, DOM updates, and network calls.

Click the line gutter to set a breakpoint for that line of code. A blue tag will indicate if a breakpoint has been set

Upvotes: 1

Medeman
Medeman

Reputation: 36

Well, in Google Chrome you can achieve this with the developer tools (and in most other popular browsers). Open them with F12 and set a breakpoint in your script under the "Sources" tab.

You can then edit and save (Ctrl-S) your script and press F8 to continue execution with the new code.

Upvotes: 1

Related Questions