Run JavaScript in a sandboxed iframe and view console output.
Run JavaScript snippets and read their console output without leaving the page. Code executes inside a sandboxed iframe with no access to this site, and a script that hangs is terminated after five seconds. It suits quick experiments, demonstrations and checking small algorithms.
A runner executes code and captures its output. Running arbitrary code is risky, so this tool puts it in an iframe with sandbox=allow-scripts and without allow-same-origin. The code gets a unique opaque origin, so it cannot read this site's cookies, storage or page. console.log, info, warn and error are replaced by functions that post messages to the parent, which prints them in the Console with colors for each level. Uncaught errors and unhandled promise rejections are also shown. A 5 second timer removes the iframe if the code has not finished, which stops infinite loops. It is isolated but not a guarantee for everything: sandboxed code may still make network requests.
No. The iframe uses sandbox allow-scripts without allow-same-origin, so it has an opaque origin and cannot reach this site's cookies, storage or DOM.
If it has not finished within 5 seconds the iframe is removed. This stops endless loops but also long legitimate computations.
No. It is placed in the sandboxed iframe on this page.
Not necessarily. Code can still try fetch or other requests under normal browser rules, so avoid running code you do not trust.
log, info, warn and error. Each is displayed with its level color; other methods are not relayed.