Message protocol
Do not call the leaderboard API directly from your iframe. Send messages to the parent page and let the Browser Game Lab bridge validate and submit scores.
Ready and resize
parent.postMessage({ type: "bgl:ready" }, "*");
parent.postMessage({ type: "bgl:resize", height: document.body.scrollHeight }, "*"); Score event
parent.postMessage({
type: "bgl:score",
score: 4200,
mode: "standard",
durationMs: 95000,
metadata: { level: 3, build: "1.0.0" }
}, "*"); Score payload rules
scoremust be an integer within the approved range for your game.modemust be one of the approved mode strings.durationMsmust be a realistic integer duration.metadatamay contain only small primitive fields such as level, build, mistakes, or accuracy.
Iframe sandbox
Approved community games run with scripts, pointer lock, fullscreen, and gamepad support. Same-origin access, popups, and forms are disabled by default.
Zip review checklist
- Zip must include an
index.htmlentry point. - No executable files, server-side code, hidden downloaders, or unreviewed ad SDKs.
- External network calls, analytics, payment links, and sponsorship code must be disclosed.