How to Pause JavaScript – Chrome

When you are developing a website, sometimes you just need to pause JavaScript so that you can work on something. There’s nothing more annoying than that stupid image slider that just won’t sit still long enough for you to troubleshoot it.

But how do we pause JavaScript? Internet trolls and people who don’t know any better will tell you to go to the developer tools window, Sources, and then click the pause button which will supposedly “Pause script execution”. And it does! But at a terrible cost… For reasons that are completely unclear to me, it also essentially “locks” the page from doing anything, and you are unable to even manipulate the code like you normally would be able to. This, of course, completely defeats the purpose of pausing it in the first place.

So what should we do? Let me show you!

How to Properly Pause JavaScript

This will allow us to pause the scripts and work on the site at the same time.

  1. Open up the Developer Tools (F12 or right click somewhere blank and click “inspect”)
  2. Click the three little dots in the top right corner, and then click settings (or just press F1 with the Developer Tools window selected)
  3. Check “Disable JavaScript”

That’s it! You would think that disabling JavaScript would prevent things from loading to begin with, but as long as it’s allowed to run when the page is opened, it just prevents it from continuing to run when you’re on the page! You should even be able to re-check it later to get it working again.

This method allows you to continue working on the page and prevents JavaScript from moving things around! It’s the best of both worlds. It took me a while to figure this trick out and I spent years being frustrated before I got it working. Never did figure out why on earth the regular “Pause script execution” button locks everything else, but this does exactly what you’re looking for.

Good luck!

About Brian Johnson

Brian Johnson is a website developer and designer living in Minneapolis, Minnesota with a passion for code and WordPress. He spends his days building WordPress websites for small businesses, developing new code with the online community, and living life.

17 Comments on “How to Pause JavaScript – Chrome”

    1. Sure it does, if you only check “disable” when you want to pause it. How is that not pausing?

      From the article:

      “as long as it’s allowed to run when the page is opened, it just prevents it from continuing to run when you’re on the page!”

    1. Sure it does, if you only check “disable” when you want to pause it. How is that not pausing?

      From the article:

      “as long as it’s allowed to run when the page is opened, it just prevents it from continuing to run when you’re on the page!”

  1. Pause will stop execution on JavaScript but it unfortunately lock the browser scroll bar. Pause in firebug worked much flexible

    1. I suspect it only locks the scrollbar if there are javascripts that hijack the functionality of scrolling. I’m typically able to scroll just fine even with JavaScript paused.

  2. This can works but still Disable is not conceptually same as Pause! Pause will stop execution on JavaScript in certain context and after that you can continue to next context when you decide. In other side Disable will not run JavaScript at all.

  3. This video is kinda inaccurate and misleading. You seem confused.

    “Disabling” JS will do just that… cause your browser to ignore included JS and disable running it. This is very different that pausing javascript execution. You would pause if you needed to trigger interactions via user behavior and pause them mid-way to inspect… for example a drop down menu with hover, etc.

    Pretty please do more research before you make a video 🙂

    1. I’m confused which part you think is incorrect. For all intents and purposes, letting everything load and then “disabling” does exactly what you think “pausing” would do. However, if you literally click “pause”, you can’t work on anything. You can’t use the inspector or use any part of the site for troubleshooting. Not very helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *