Embedding and sitelock policy
Every rule here has a reason and a check you can run before you submit. Terms such as build, basic launch and studio are in the glossary.
Where your game runs#
A game uploaded to ZokoGames is served from its own origin:
https://g-<your-game-slug>.zokogames.com/<build-id>/index.htmlCovers come from https://imgs.zokogames.com/. Because each game has its own origin, your localStorage, cookies and service workers are isolated from every other game and from the portal. This is also the Origin your own game server sees; the Technical step of the game's editor shows it with a copy button. The portal page embeds the game in an iframe and the SDK talks to it through postMessage.
Letting other sites embed your game#
Partner sites can show your game with an iframe that points at the portal's embed player:
https://www.zokogames.com/embed/<your-game-slug>Embedding is off by default and you decide per game. In the submission wizard, open the Technical step and find the Audience and distribution card. Switch on Allow embedding on partner sites (you can change it later on the game's Edit and submit tab). When it is off, /embed/<slug> shows a short notice with a link to the game page instead of the game, and the game is only shown on ZokoGames pages and apps.
- Games made for children can never be embedded. Turning on Made for children switches embedding off automatically and the toggle stays unavailable.
- The embed player is a minimal page: the cover, the game name and a Play button. The game loads only after the visitor clicks, in the same sandboxed iframe the portal uses, so the rules in the next section apply unchanged. A Play on ZokoGames link and a fullscreen button are always visible.
- The embed route may be framed by any website (
frame-ancestors *). The normal game page stays restricted to ZokoGames. - Your game origin (
g-<slug>.zokogames.com) still only lets the portal frame it. Partner sites frame the embed player, never your build directly. The embed player is a plain frame without portal services, so the SDK finds no portal to answer its handshake and reports"disabled"there: no ads, accounts, cloud saves or purchases. Make sure the game still starts and plays without them (see environments). - A game with embedding on shows an "Embed this game" snippet builder on its page, with responsive, 960x540, 640x360 and portrait sizes.
Restrict which sites may embed (allowed sites)#
By default, with embedding on, any https site may frame the embed player. To lock it down, add Allowed sites to the game (the same card, or the allowedOrigins field of the developer API). The list is enforced by our game host through frame-ancestors: a site that is not on it gets a blocked frame, even if it copies the embed code.
| Entry | Meaning |
|---|---|
https://partner.example |
That exact site (and port, if you give one). |
https://*.partner.example |
Every sub-domain of partner.example, but not partner.example itself. List both when you need both. |
Rules, checked when you save: https only; an origin and nothing else (no path, query, fragment or credentials); no IP addresses or localhost; a wildcard is only a leading *. on a registrable domain (*.example.com is fine, *.com and *.co.uk are not) and cannot carry a port; our own domain is always rejected; at most 10 distinct entries. Entries are lower-cased and de-duplicated, and a default port (:443) is dropped. An empty list keeps today's behaviour. The list only matters while Allow embedding on partner sites is on, and games made for children are never embeddable whatever the list says. Changes reach the game host within about two minutes.
If your build has a domain lock, make sure it allows the embed player's host (it is zokogames.com, so the sitelock rules already cover it). Put anything unusual in the Server host and notes for reviewers field of the Your own game server and notes for reviewers card, further down the Technical step of the game's editor (up to 1,000 characters).
Why embedding is off by default: a partner page would show your game outside the portal's own pages, so it is your decision, and children's games must never leave the portal. Check before submitting: open /embed/<slug> once the listing is saved: with embedding off you see the notice, with it on you see the cover and the Play button. Then press Play and confirm the game starts without ads, accounts or cloud saves.
The iframe sandbox#
The frame carries these sandbox tokens:
allow-scripts allow-same-origin allow-forms allow-pointer-lock
allow-orientation-lock allow-modals allow-downloads allow-presentationPopups are opt-in per game: tick Needs popups in the technical step of the submission if you need one (for example an OAuth window). Without it, window.open and target="_blank" links are blocked. Kids games, and any game played in kids mode, run without allow-downloads, as they already run without popups.
The frame also delegates these permissions: autoplay, fullscreen, gamepad, clipboard-write, accelerometer, gyroscope, xr-spatial-tracking and keyboard-map. Camera and microphone are off by default. If your game needs one, say so in the submission notes; staff can grant it for that game after review. The Builds and updates tab of the game shows whether it has a grant. A grant covers the build staff checked: the next build you submit, send for review or activate ends it, so ask again in the note for that build (for a Basic Launch update, which has no review, ask support). Kids games never get them. A browser still asks the player before it grants camera or microphone.
What this means in practice:
- Do not depend on
window.top,window.parentcontent or cookies shared with another site. UseSDK.datafor saves. - Do not add your own fullscreen button. The portal provides one.
- Pointer lock works after a user gesture. Handle Escape by pausing.
- Navigation of the top window is blocked. Do not redirect players away from the game.
Why: each game runs on its own origin in a sandbox, so one game cannot read another's data or move the portal page. Check before submitting: play in the Preview tool, which uses the real frame, with the console open; the first red error is usually the one a reviewer sees. Finding codes: service_worker (a game worker can clash with the portal's offline saving), cookie_access (cookies are not shared inside the frame) and top_navigation (a sandboxed frame cannot navigate the portal) in frame behaviour codes. cookie_access and top_navigation are only a note when the code looks like a known vendor library.
Sitelock#
Sitelock stops people re-hosting your build. It is optional, and it must never lock out the portal or your own testing.
const host = location.hostname;
const allowed =
host === "zokogames.com" || host.endsWith(".zokogames.com") ||
host === "localhost" || host === "127.0.0.1" || host.endsWith(".localhost");
if (!allowed) {
document.body.textContent = "Play this game on zokogames.com";
throw new Error("sitelock");
}Rules:
- Allow
zokogames.comand every subdomain of it. Game origins use theg-<slug>pattern today and may change; never lock to one exact hostname. (This is about locking the build itself. A server's CORS allow-list is different: it should name the game's own origin exactly, never*.zokogames.com.) - Allow
localhostso the SDK's local mode and the Preview tool keep working. - Run the check before you load assets, but do not block the first frame on a network call.
- A visible message beats a blank screen. Reviewers must be able to tell a sitelock from a crash.
Why: a lock that is too tight locks out the portal, the embed player and the reviewer. Check before submitting: open the game in the Preview tool and on localhost; both must start. A hard-coded host also shows as an external host in the report.
Store apps#
The portal's phone apps (an Android Trusted Web Activity and an iOS wrapper; they are being prepared and are not in the stores yet) open the portal website itself, so your game is still framed by a www.zokogames.com page. You do not add an app origin, a package name or a scheme such as capacitor:// to the allowed sites, and the sitelock check passes as it does in a browser. One thing does change inside a store app: the portal serves no ads there (see ads, error adsDisabled), so keep your game working when an ad request ends in an error. If you embed the game on your own site and that site is also wrapped in an app, the wrapper must load your site from its https domain name: the allowed sites accept only https domain names, so an origin such as https://localhost, an IP address or a custom scheme cannot be added.
Inside the Android app the portal also shows no ad before the game starts, banner requests fail with bannersDisabled, and in-game purchases are off: SDK.store.isAvailable is false and buyItem rejects with purchaseInitFailed (see in-game purchases). Hide your shop when the store is not available.
Hosting on your own server#
This section is for a game whose page is hosted on your own server. A game that is uploaded to ZokoGames and only calls your server needs none of it: it needs your server to allow its origin, described under privacy and your own game server in the technical requirements. If you choose "on your own server" in the submission, your https page must allow being framed by the portal:
Content-Security-Policy: frame-ancestors 'self' https://zokogames.com https://*.zokogames.comDo not send X-Frame-Options: DENY or SAMEORIGIN. Cross-origin cookies are not available in the frame, so use the data module and the verified token for identity. Games on your own host only earn when they use the SDK, and they are judged on time to gameplay. See technical requirements. Check before submitting: enter your address in the Preview tool. It frames the page in the same portal frame, so a header that forbids framing shows up at once.
Embedding the SDK handshake#
You do not need to code the handshake. SDK.init() posts a request to the parent window, pins the origin that answers and ignores messages from anywhere else. Only an answer from ZokoGames (https on zokogames.com or one of its subdomains, except the game hosts g-<slug> and the preview runner preview-run), a local host (only while the game itself runs on a local host) or the game's own origin counts: another site that frames the game cannot pose as the portal. If no portal answers within 1.5 seconds, the SDK falls back to local mode on localhost (or when the URL has useLocalSdk=true), and otherwise reports "disabled". See environments.