5

I have some JavaScript that, I believe, is stuck in an infinite loop. I know I can just reload the page, but I have data in a form on the current page that I'd like to keep. The tab is completely unresponsive, so I can't just copy and paste everything and then reload. So is there any way to kill the javascript thread, but keep the DOM in Chrome?

6
  • 1
    "Is there any way to kill the javascript thread, but keep the DOM in Chrome?" Nope. You just got to fix your infinite loop. Commented Oct 24, 2016 at 19:59
  • After thirty seconds Chrome gives you the chance to stop the executing script. You can recover the information then. Commented Oct 24, 2016 at 20:00
  • Here's the painful issue... The infinite loop is in a codepen.io pen. So if I reload, I lose a lot of the code that actually caused the infinite loop. Commented Oct 24, 2016 at 20:01
  • As @BCartolo mentioned, you should get a prompt to kill it. If not, I guess take a screen shot and capture as much of the code as you can... Commented Oct 24, 2016 at 20:02
  • If you are writing lots of things on the web it's a good idea to use this extension: chrome.google.com/webstore/detail/lazarus-form-recovery/… Commented Oct 24, 2016 at 20:03

3 Answers 3

4

You can open the developer console F12 and stop the scriptenter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

You can't stop the script, but you can pause it and inspect the DOM.
@Derek朕會功夫 You can stop the script - just click on the Pause button, then click-and-hold on the Play button and choose Stop from the drop-down menu.
3

Open chrome developer tools and go to the sources tab. On the right panel press "pause script execution".

enter image description here

2 Comments

Then click-and-hold on the Play button and choose Stop from the drop-down menu in order to stop the script execution.
@nuitech - how do you click Stop when mouse is already on click-and-hold, the moment you release it to stop the execution it doesn't work, why is there no stop button, i mean really now?
1

looks like someone had the same problem

Cancel infinite loop execution in jsfiddle

Answer:

With the developer mode, go into resources and find your script and copy and paste it into a text document or a new window. If you can't find it in resources, do a search for a variable or line of code you used.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.