Project freezing on opening

If your project freezes your browser when you open it, it's likely due to an infinite loop or recursion in your code.

Why does this happen?

Sometimes you can write code that loads the processor at 100%, causing the browser to freeze. This usually happens with:

  • Infinite loops (while (true))
  • Infinite recursion
  • Very large operations running on page load

Loop Protection

PlayCode has built-in protection for for, while, and do while loops. However, it's impossible to protect against infinite recursion.

How to fix a frozen project

Follow these steps to regain access to your project:

  1. Close the frozen browser tab completely.
  2. Open a different project or create a new one at playcode.io/new.
  3. Click the Menu icon (top left).
  4. Go to Preferences.
  5. Uncheck Preview Run on Opening.
  6. Important: Do this BEFORE opening your frozen project!
  7. Now open your frozen project.
  8. The code won't run automatically, so you can fix the infinite loop/recursion.
  9. After fixing the code, you can re-enable "Preview Run on Opening".

Prevention

To avoid freezing issues:

  • Always test loops with a counter limit during development
  • Add base cases to recursive functions
  • Use "Preview Run on Opening: OFF" while debugging problematic code

Need more help?

Can't find what you're looking for? Chat with us or send us an email.