Operator docs Get sandbox access

Guides

Embedding the game

The game runs in the player’s browser and talks to our servers directly. Your page decides where it appears: in an iframe on your site, or in a tab of its own.

Two ways to open the game

Iframe

Inside your page

The player stays on your site, with your header, controls and support around the game. Needs your page origin registered, unless any HTTPS page is allowed.

New tab

A page of its own

Open or redirect to the launch URL. Needs no page origin registration, and it’s how you open the game in the sandbox.

Either way, the game loads from our game origin, such as https://sandbox-game.luckyeight.games, and keeps that origin inside your page. It never needs cookies or access to your page.

Register your page origins

The game sends a Content Security Policy with frame-ancestors set to the registered page origins. Browsers refuse to show it in a frame on any other origin, and an empty list means no embedding at all.

  • An origin is a scheme, a host and a port: https://casino.example.com and https://www.casino.example.com are two origins.
  • No paths, no wildcards and no plain HTTP.
  • Browsers check every frame up the chain. If another site frames your page, its origin needs registering too.

Send us the origins per Brand during onboarding.

If you embed the game on more sites than you can list, we can allow any HTTPS page instead: the policy is then frame-ancestors https:. The game page has one policy for the whole Environment, so once any HTTPS page is allowed, browsers no longer limit which site frames it. Pages served over plain HTTP still can’t. Since any HTTPS site can, keep launch URLs away from pages you don’t control.

Sandbox

The sandbox serves the game with a fixed policy that lets only our own demo page, https://demo.luckyeight.games, frame it. Registering your origin doesn’t change that, so open sandbox launch URLs in a new tab.

Stage

On the stage, pages on the origins you registered may frame the game. We apply a new or changed origin for you, so tell us before you test from another page.

The iframe

<iframe
  src="LAUNCH_URL"
  title="Golden Jaguar"
  allow="fullscreen"
  referrerpolicy="no-referrer"></iframe>
  • Don’t add the sandbox attribute. A sandboxed frame gets an opaque origin, and the game can’t reach our servers from it.
  • allow="fullscreen" lets the game inside the frame use full screen. Your page can make its own container full screen without it.
  • referrerpolicy="no-referrer" keeps your page address out of our logs. The launch code sits in the URL fragment, which browsers never send.
  • If your page has its own Content Security Policy, allow the game origin in frame-src.
  • Give the game as much of the viewport as you can. It scales to fit any size and fills wide screens. On phones, a frame that covers the whole viewport works best.

Starting the game

The game shows its loading screen, then a Play button. The launch code is redeemed when the player presses Play, not when the frame loads, so loading the URL doesn’t use it up. The code still expires at the launch URL’s expires_at, so open the game right after you create the GameSession.

Browsers start sound only after the player interacts with the page. The Play press inside the game counts, so there’s nothing to do on your side.

A pattern that keeps the URL out of your page

Our own demo page opens the game like this: a form posts to your backend and targets the iframe. Your backend creates the GameSession and answers with a redirect to the launch URL, so the URL never passes through your page’s JavaScript or history.

HTML
<form method="post" action="/games/golden-jaguar/launch" target="game-frame">
  <button type="submit">Play Golden Jaguar</button>
</form>
<div class="game-overlay" hidden>
  <button type="button" class="game-close" aria-label="Close the game">×</button>
  <iframe name="game-frame" title="Golden Jaguar" allow="fullscreen" referrerpolicy="no-referrer"></iframe>
</div>
Your backend’s answer to the form
HTTP/1.1 303 See Other
Location: https://sandbox-game.luckyeight.games/launch/…#code=…
Cache-Control: no-store
Referrer-Policy: no-referrer
JavaScript and CSS
const overlay = document.querySelector('.game-overlay');
const frame = overlay.querySelector('iframe');

document.querySelector('form[target="game-frame"]').addEventListener('submit', () => {
  overlay.hidden = false;
  // Full screen must be requested in the same click. iPhone Safari can't
  // make an element full screen; there the overlay covers the viewport.
  overlay.requestFullscreen?.({ navigationUI: 'hide' }).catch(() => {});
});

overlay.querySelector('.game-close').addEventListener('click', () => {
  if (document.fullscreenElement) document.exitFullscreen().catch(() => {});
  overlay.hidden = true;
  frame.src = 'about:blank'; // ends the game in this browser
});

/* .game-overlay { position: fixed; inset: 0; z-index: 100; background: #000; }
   .game-overlay iframe { width: 100%; height: 100dvh; border: 0; }
   .game-close { position: absolute; top: 12px; right: 12px; } */

Protect the launch endpoint like any other action of a signed-in player: check the player’s session and guard against cross-site request forgery. To avoid a white flash while the game loads, you can hide the frame behind a spinner until its load event.

In v1 the game sends no events to your page, such as postMessage, and doesn’t navigate to your lobby or cashier. Your page owns the controls around the game: put your close, lobby and cashier buttons next to the frame or over one corner of it, as in the example above. The lobby and cashier URLs you send are stored with the GameSession; the current game client doesn’t open them.

Closing the frame ends the game in the browser. It doesn’t end the GameSession, and money movement of an unfinished Round continues on our side.

Reloads and new launches

A launch code works once. If the player reloads the frame, the game can’t reconnect with the same URL and asks for a new launch. Get a new launch URL from your backend, as described in Relaunch and re-entry, and load it into the frame. When a new launch code of the same GameSession is redeemed elsewhere, the game in the previous tab stops.

The game’s own session also ends 30 minutes after the player presses Play, by default, even in the middle of play. The game then asks for a new launch in the same way. What expires, and what to do lists every lifetime involved and the right way back for each.

Checklist

  • Outside the sandbox, your page origins are registered for each Brand that embeds the game, or the Brand allows any HTTPS page.
  • The iframe has no sandbox attribute, and has allow="fullscreen" and referrerpolicy="no-referrer".
  • Launch URLs reach the browser over HTTPS and appear in no log, analytics event or page URL.
  • Your page offers its own close, lobby and cashier controls.
  • A reload or an expired launch leads to a fresh launch URL from your backend.