Embedding an app in a website
Show a public instant Python app (PyLevate), pygame game or web app on your own site with an iframe.
A public app can be shown inside another website: a game on your blog, a small tool in your documentation.
Turn it on
Open Share, set Who can view to Public, and tick Other websites may embed this app. It is off for every app until its owner turns it on. Copy the code that appears and paste it into your page:
<iframe src="https://apps.pycorner.dev/embed/<app id>/" title="My game" width="800" height="600"
style="border:0;max-width:100%" loading="lazy" allow="fullscreen; gamepad"></iframe>
Change width and height as you like. Under the app there is a slim footer with its name and an “Open on PyCorner” link.
Instant Python apps and games (Python compiled to a small web app by our PyLevate compiler), pygame games and web apps (HTML and JavaScript) can be embedded. Streamlit, marimo, notebook and PyScript apps cannot yet: they need browser features a frame inside another site does not get.
What stops an embed
The embed address answers only while the app is public, the switch is on, and the app is online. Make the app private or unlisted, turn the switch off, or close your account, and every embed of it shows “This app is not available here” from the next request on. An app’s IP rules apply to embeds too.
Visitors are never signed in there
An embedded app always runs as for a visitor without an account, also for somebody who is signed in to PyCorner in the same browser:
- the embed gets its own short-lived token that names nobody, and the address of the app inside the frame accepts no other kind;
- nothing of an account is reached: no save in the account (a game keeps its saves in the browser), no entry on a leaderboard (the boards are shown, the visitor’s own best stays in the browser);
- the app still works as it does for any visitor: the databases, APIs and AI its owner opened to visitors answer.
Browsers (Chrome, Firefox, Safari) keep what a framed page stores apart for each site it is embedded in, so a game’s local saves on your blog are not the ones on PyCorner, and the site that embeds an app can never look into the frame.
What may be framed
Only the embed address (/embed/<app id>/ on the apps origin, and the app’s files under it) tells browsers that any site may frame it. Every other address on the apps origin can be framed by PyCorner’s own pages only, and the PyCorner app itself (app.pycorner.dev), where the sign-in lives, is never opened to other websites this way.
A site with a strict Content-Security-Policy needs frame-src https://apps.pycorner.dev (on eutonomous: https://csr-apps.eutonomous.eu).