DEV Community

Tyler Smith
Tyler Smith

Posted on • Edited on

1

How to Open a CodeSandbox Project Without a Browser Preview

From time to time, we all write really bad code. Sometimes, that code is a poorly-written JavaScript loop that completely locks the main thread and prevents anything else from working in that browser tab. If you're working in a standalone text editor, this isn't a big deal: you kill the browser tab, fix your code, then reopen the browser tab to see if your code works.

However, if you're using CodeSandbox, your code is execute in the same tab as the editor. This can make it impossible to fix the bug that's locking the main thread. Thankfully, CodeSandbox has an undocumented way of getting around this.

If you append &runonclick=1 to the end of a project's URL, it will prevent the code preview from running until you click into the preview window. This will allow you to fix your buggy code before it locks up the main thread.

At the time of writing this post, there is no way to do this through the UI.

Thank you to garethx for posting this solution to a GitHub issue!

Heroku

Built for developers, by developers.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly — using the tools and languages you already love!

Learn More

Top comments (0)

Jetbrains image

Is Your CI/CD Server a Prime Target for Attack?

57% of organizations have suffered from a security incident related to DevOps toolchain exposures. It makes sense—CI/CD servers have access to source code, a highly valuable asset. Is yours secure? Check out nine practical tips to protect your CI/CD.

Learn more

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay