mugon.net docs
SDKs

Saving data

Why localStorage and friends don't work in a mugon game yet.

To keep a game from touching the platform page or other games, it runs in a sandboxed iframe with an opaque origin. Browsers give such a frame no persistent storage:

  • localStorage and sessionStorage throw a SecurityError.
  • IndexedDB (and anything built on it) is unavailable.
  • Cookies are not stored.

That includes what engines do behind your back: Unity's IDBFS persistent data path, Godot's user:// saves and similar mechanisms won't persist between sessions.

What to do today

Keep state in memory for the session. There is currently no supported way to persist data between sessions from inside a game.

A Mugon persistence API (saving through the platform, tied to the player's account) is planned and will be part of the SDK context. Until then, design your game so it doesn't depend on saved state, and don't rely on the engine's storage working: guard calls that would throw.

Files you download are cached

This doesn't affect the game's own files: those are cached by the platform, see the file proxy.

On this page