Mini Apps run as sandboxed cross-origin iframes inside the Startale App. This environment imposes browser-level storage restrictions that differ from a normal browser tab. Understanding them upfront prevents silent bugs in production.Documentation Index
Fetch the complete documentation index at: https://docs.startale.com/llms.txt
Use this file to discover all available pages before exploring further.
What works and what does not
| Mechanism | Works | Notes |
|---|---|---|
localStorage | Yes | Recommended. Stable across sessions from app.startale.com. |
IndexedDB | Yes | Same origin rules as localStorage. Good for structured or large data. |
sessionStorage | Yes | Not persisted across page reloads or frame re-opens. Suitable for ephemeral in-session state only. |
JavaScript cookies (document.cookie) | No | Silently dropped on Safari and iOS due to Intelligent Tracking Prevention. See below. |
Set-Cookie from your backend | No | Same cross-origin restriction: cookies set by a third-party origin are blocked in iframes. |
| Storage Access API | No | Not available. The iframe sandbox is missing allow-storage-access-by-user-activation. |
Why cookies fail silently
Mini App URLs are always cross-origin relative toapp.startale.com (all Mini Apps are hosted on their own domain). The Startale App embeds them with:
allow-same-origin flag preserves the Mini App’s own origin (so the Mini App can access its own localStorage), but the frame is still third-party to app.startale.com.
Safari / iOS, Intelligent Tracking Prevention: ITP blocks third-party cookie storage in cross-origin iframes by default. document.cookie = "..." runs without throwing an error, but the cookie is silently dropped or scoped to ephemeral storage that does not survive navigation. This is not a bug in the Startale App; it is Safari’s enforced policy.
Chrome, CHIPS (Partitioned Cookies): Third-party cookies require the Partitioned attribute. Without it, behavior is unreliable and being phased toward full removal.
The key misconception: SameSite=None; Secure controls whether a cookie is sent on cross-site requests. It does not override ITP or Partitioned Cookie policies that block the cookie from being stored in the first place.
localStorage: the recommended approach
localStorage works reliably in the sandboxed iframe because allow-same-origin preserves the Mini App’s origin. Storage is scoped to your Mini App’s origin and is stable across repeated sessions launched from app.startale.com.
Saving state on close
The reliable hooks for catching a frame close or navigation arevisibilitychange and pagehide. Register them on mount and write to localStorage synchronously inside the handler.
sdk.actions.ready():
Backend authentication: replace cookies with Bearer tokens
If your Mini App authenticates against a backend API, return the session token in the JSON response body and store it inlocalStorage. Do not rely on Set-Cookie.
Authorization: Bearer <token> instead of reading from the Cookie header.
IndexedDB: structured or large data
For structured data, larger payloads, or binary assets, useIndexedDB. It follows the same origin rules as localStorage and works reliably inside the iframe.