Frequently asked questions
›Is it safe to run code here?
The preview runs in an iframe with sandbox="allow-scripts" and without allow-same-origin, so the code gets an opaque origin: it cannot read this site's cookies, storage or page, and it cannot navigate the page you are on.
›How do I use npm packages?
Add the package name (optionally with a version, like canvas-confetti@1) to the import map, then import it in the JS. The playground maps it to esm.sh and runs your script as an ES module.
›How do I share a pen?
Press Share: the HTML, CSS, JS and libraries are compressed into the # of the link, which never reaches any server. Whoever opens it sees exactly your code.