Game redirects
If your team has more than one game on the platform, you can send the player from one of your games to another — for example, from a "play our other game" button.
Games run inside an iframe and cannot navigate the top-level page themselves. Instead, JestSDK.redirectToTeamGame() asks the platform to perform the navigation:
const result = await JestSDK.redirectToTeamGame({
gameSlug: "trivia-battle",
});
if (result.result === "error") {
console.error("Redirect failed:", result.error);
}
The gameSlug is the slug of the target game — the <slug> part of its jest.com/g/<slug> URL.
Redirects are limited to games owned by the same team as the calling game. The platform verifies ownership before navigating; attempting to redirect to another team's game is rejected with a different_team error and no navigation happens.
On success, the promise resolves with { result: "success" } and the platform navigates to the target game. By default the player is shown the usual exit confirmation dialog when leaving your game; pass skipGameExitConfirm: true to skip it.
You can also pass an optional entryPayload, which is delivered to the target game and available there via JestSDK.getEntryPayload(). This is useful for attribution or for carrying context across the redirect:
await JestSDK.redirectToTeamGame({
gameSlug: "trivia-battle",
entryPayload: { source: "cross_promo_button" },
skipGameExitConfirm: true,
});
JestSDK.redirectToTeamGame()
redirectToTeamGame(options: {
gameSlug: string;
entryPayload?: Record<string, unknown>;
skipGameExitConfirm?: boolean;
}): Promise<
| { result: "success" }
| { result: "error"; error: "game_not_found" | "different_team" | "internal_error" }
>;
Options:
| Name | Type | Description |
|---|---|---|
gameSlug | string | The slug of the target game. Must belong to the same team as the calling game. |
entryPayload | Record<string, unknown> | Optional. Metadata delivered to the target game via getEntryPayload(). |
skipGameExitConfirm | boolean | Optional. When true, skips the exit confirmation dialog shown when leaving the current game. Defaults to false. |
Error results:
| Error | Description |
|---|---|
game_not_found | No game with the given slug exists. |
different_team | The target game is owned by a different team; the redirect was refused. |
internal_error | A transient platform error occurred. Safe to retry. |
The method throws if the SDK is not initialized or the arguments are invalid.