# HTML game files on Go Bananas

## A complete HTML game can be imported into Go Bananas as it is, from the create panel, the Upload Asset window, or ChatGPT and Claude, as long as it follows the rules of the game sandbox.

Browser games are web pages: an HTML file with its JavaScript and CSS, often drawing on a `<canvas>`. Every game on Go Bananas is one such HTML file. If you already have a game, whether you wrote it, an AI made it, or you built it with another tool, you can import it and play, edit, publish and share it here.

## What HTML import is good for

- **Games you already made:** bring them in and share them with a link.
- **Games an AI wrote in a chat:** keep the exact game instead of regenerating a different one.
- **Prototypes:** import a quick test, then keep improving it with chat edits.

The game has to be one self-contained HTML file, with its scripts and styles inside it or loaded from the allowed sites listed below. A [ZIP](/formats/zip) can't carry a game: ZIP uploads are for 3D models only, and any HTML inside them is removed.

## Importing an HTML game

There are three ways in, and they behave differently. On the website you need to be signed in with a verified email.

**1. Create panel (📎 or drag).** Press the 📎 button or drag the `.html` file onto the chat.

- The game is checked for malicious code, then **published right away**, so anyone can find and play it.
- Tags such as racing or turn-based are guessed from its content.

**2. Upload Asset window.** In the Assets tab press **Upload Asset**, or in the editor press **Upload New**.

- The game is created **unpublished**, so only you see it until you publish it.
- It takes its title from the page's `<title>`, gets the icon 📦 and the tag "imported", and is set up for up to 4 players.
- Deleting that asset also deletes the game.

**3. ChatGPT or Claude.** See "From ChatGPT or Claude" below.

| Way in | Size limit | Result |
| --- | --- | --- |
| Create panel | 5 MB | Published right away |
| Upload Asset window | 10 MB | Unpublished game |
| ChatGPT or Claude | 900 KB | Private draft |

A game needs at least 50 characters of code, and an account can have at most 200 games.

## The game sandbox: what works

Games run in a sandboxed frame, for the safety of players. The frame has no access to the Go Bananas page, so some browser features are blocked:

| Blocked | What works instead |
| --- | --- |
| `localStorage`, `sessionStorage`, IndexedDB and cookies throw errors, which can crash a game on load | Keep progress in normal variables |
| `alert()`, `confirm()` and `prompt()` | Draw your own dialogs and buttons in the game |
| `fetch` or XHR to outside APIs | Put the data inside the game |
| Scripts from most sites | Scripts from cdnjs.cloudflare.com, cdn.jsdelivr.net and unpkg.com |
| External CSS files | Styles inside the page; Google Fonts are allowed |
| Relative URLs like `img/hero.png`, because games run from a blob: address | Full `https://` addresses |
| Audio and video from other sites | Audio uploaded to Go Bananas, sounds made with the Web Audio API, or `data:` URIs |

Images can load from any `https://` address. Embedded frames and plugins are blocked.

Every game also gets a few helpers from Go Bananas before its own code runs:

- `window.GAME_ASSETS` lists the creator's uploaded models, images and audio with their full addresses, for example `GAME_ASSETS.images['hero'].url`.
- `getAssetUrl(name)` finds an asset by name.
- `window.__audio` plays sounds reliably, including on iPhones.

```js
// a sound uploaded as "jump.mp3"
const jump = GAME_ASSETS.audio['jump'].url;
__audio.load(jump); // start loading early, so it's ready the first time it plays
button.addEventListener('click', () => { __audio.init(); __audio.play(jump); });
```

## Tips and common problems

- **Game crashes on load:** look for `localStorage`. Replace saves with variables in memory, since the sandbox throws an error the moment the game touches storage.
- **Restart button doesn't work:** reloading the page is unreliable in the sandbox. Reset the game's variables in JavaScript instead of calling `location.reload()`.
- **Pictures or sounds missing:** replace relative paths with full `https://` addresses, or upload the files to Go Bananas and use `GAME_ASSETS`.
- **A library won't load:** move it to cdnjs, jsDelivr or unpkg.
- **Styles missing:** paste the CSS into a `<style>` tag in the page.
- **After importing,** you can keep changing the game with chat edits, like any game made on Go Bananas.

## From ChatGPT or Claude

With the Go Bananas app in ChatGPT or the connector in Claude, an assistant can import a game it wrote in the conversation:

- **import_game** sends the whole HTML in one go, which suits small games (about 50 KB or less).
- **import_begin, import_append and import_commit** send larger games in parts: up to 256 KB per part and 900 KB in all. Unfinished imports expire after 10 minutes without activity.

Either way, the import is free (no tokens) and the game is saved as a **private draft**. The HTML must be a full page with a `<script>` or a `<canvas>`, and you need a registered account with a verified email.

The import doesn't block a game that breaks the sandbox rules. It warns about what it finds: storage, cookies, `alert()`, scripts from other sites, external CSS and outside requests. The assistant can then fix the game with an edit.

## Related

- [All file formats](/formats)
- [ZIP bundles of 3D models](/formats/zip)
- [GLB files](/formats/glb)
- [Using Go Bananas from ChatGPT and Claude](/guides/chatgpt-and-claude)
- [How to make a video game](/guides/how-to-make-a-video-game)
- [Making games work on phones](/guides/games-on-phones)
- [Making 3D games](/guides/3d-games)
