Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a keyboard shortcut in Google Chrome which will break script execution? (Equivalent to pressing the || "Pause script execution" button in the Developer Tools Scripts panel.)

I'd like to use the Dev Tools to inspect an element in its mouseover state; the mouseleave code will obviously run if I try to actually click the pause button!

share|improve this question
up vote 30 down vote accepted

While I haven't found the exact solution to this problem, I did come up with a one-liner that can be put in a page to achieve my goal:

$(window).keydown(function(e) { if (e.keyCode == 123) debugger; });

This will cause execution to be paused when you hit F12.

(debugger is a JavaScript statement that forces a breakpoint.)

Update: Dev Tools has many built-in shortcuts (press F1 for a list), but you must be focused in the Dev Tools window for them to work. Pausing script execution is F8 (when looking at the Sources tab, as of Chrome 45) or Ctrl+/.

The above one-liner might still be useful if you need to stay focused in the page before pausing.

share|improve this answer
+1 Very useful! Thanks. – Andrew Mao Jan 30 '14 at 0:49
F8 only works when you are on the "Sources" page in DevTools (Chrome 40) – netvope Jan 26 '15 at 3:20

I wrote a quick little Chrome Extension that allows you to press the Pause button on your keyboard to pause javascript execution

How to get it:


  1. Keep chrome developer tools open
  2. Press pause/break on your keyboard
share|improve this answer
That's really nice, but the extension won't install unless it's publicly available in the Chrome web store. Right now I'm simply calling its code manually when I need it. – flu Dec 4 '14 at 15:32
@Flu, I added it to the Chrome Web Store. Enjoy – SpareBytes Dec 8 '14 at 3:22
Great, thank you very much! – flu Dec 8 '14 at 9:09
This worked great – I was able to pause so that I could examine HTML dynamically inject into the page. Using the Developer Tools didn't work because the HTML was being removed by the code when it lost focus. – Kenny Evitt Jan 12 '15 at 16:05

Google's list of keyword shortcuts says that "Pause / resume script execution" is F8 or Ctrl/Cmd + \.

There are easier ways to inspect things in odd states like hover or active. First find the DOM node in the Elements pane of Chrome Dev Tools. Now you can either right-click the node and look at the "Force Element State" in the context menu, or select the node and look in the Styles tab and find the dashed-box-with-mouse-pointer icon in the top right (next to the +/plus icon which lets you add a new CSS rule to, the element you selected).

When you activate one of these states, the left margin of the elements pane gets a little circle to indicate that you've overridden the natural state of the element on that line.

share|improve this answer
F8 doesn't work in the main browser window, only in the Dev Tools window. Using Force Element State doesn't help when it's a script listening to events (rather than just CSS) that is doing stuff. – josh3736 Oct 20 '14 at 1:51

Exercising my Google-fu, I found the official google list of Chrome keyboard shortcuts

It doesn't seem like there's one dedicated to it. You could always write a plugin which would interpret a key combination as a pause button, though, if you wished.

share|improve this answer

You must log in to answer this question.

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