---
title: "Deck URL and window.__deck"
description: "The URL hash and parameters a running deck reads, and the browser API it exposes for automation."
---

> Documentation Index
> Fetch the complete documentation index at: https://sandrinodm.github.io/deckster/llms.txt
> Use this file to discover all available pages before exploring further.

# Deck URL and window.__deck

Use this page to link to a slide and step, open a deck in static mode or as the presenter window, and drive a running deck from a browser script such as a Playwright test. Every deck, in `deck dev`, `deck present` or a build, reads the same URL and exposes the same `window.__deck`.

## The URL hash

A deck writes its position into the URL as `#/<slide>/<step>`:

- `<slide>` is the slide's number in the slide list, counted from 1, hidden slides included. It matches the page numbers in a deck without hidden slides; the page numbers an audience sees count shown slides only (see [hidden slides](https://sandrinodm.github.io/deckster/write-slides/hidden-slides/#two-numbering-rules)). In a hash you type or link to, it may also be the slide's id: `#/steps/2` is the same as `#/2/2` in the `hello` deck.
- `<step>` counts from 0, where 0 is the slide before any `<Step>` shows (see [steps](https://sandrinodm.github.io/deckster/concepts/steps/)). Leave it out for step 0: `#/3`.

The deck writes the number back: open `#/steps/1` and the address bar shows `#/2/1`. A hash with an unknown id or a number out of range is ignored. A hash that names a hidden slide opens it, and a deck opened without a hash starts on the first shown slide (new in 0.5.0).

## Query parameters

The built deck reads three query parameters:

| Parameter | Does |
| --- | --- |
| `?static` | Static mode: every slide mounts, and motion, video and live demos show their final state. `?static=1` and `?static=true` also turn it on; `?static=0`, `false` or `no` leave it off. `deck shot`, `deck lint` and the exports open pages this way. See [static mode and readiness](https://sandrinodm.github.io/deckster/concepts/static-mode-and-readiness/). |
| `?presenter` | Opens the page as the presenter window, with notes and timer, instead of the audience window. In a browser, `p` opens this URL at the current position. |
| `?embed` | New in 0.4.0. Embed mode, for a deck shown in an iframe on another page: the slides and the brand's chrome without the presenter tools, overlays or plugin key and click handlers, and a small control with previous and next buttons, the slide count (shown slides only since 0.5.0) and an "Open full deck" link that opens the same position without `?embed` in a new tab. Takes the same values as `?static`. |

They combine with the hash: `http://localhost:5173/?static#/steps/2`.

## `window.__deck`

While a deck is mounted, `window.__deck` holds its automation API, the one `deck shot`, `deck lint` and the exports use:

| Member | What it is |
| --- | --- |
| `slides` | The slides in order, hidden ones included. Each has `index` (from 0), `id`, `file`, `title`, `layout`, `stepCount` (step 0 included; `undefined` until the slide has mounted once), `notes`, `budget` (in seconds), `hidden` (`true` for a slide with `hidden: true`; new in 0.5.0) and `frontmatter`. |
| `position` | The slide and step on screen: `{ slide, step }`, the slide counted from 0. |
| `isStatic` | Whether the page runs in `?static` mode. |
| `goto(slide, step?)` | Shows a slide, by index from 0 or by id, at a step (default 0). A step past the slide's last clamps to it. It lands on a hidden slide too. Throws a `RangeError` for a slide that does not exist. |
| `next()` | The next step, or the next shown slide after the last step; hidden slides are skipped. Does nothing at the end. |
| `prev()` | The previous step, or the previous shown slide at its last step; hidden slides are skipped. Does nothing at the start. |
| `ready()` | A promise that resolves when the slide on screen (every slide, in static mode) is ready to capture. |

`goto`, `next` and `prev` apply synchronously: when the call returns, the new slide is rendered. They never morph; a morph that a key press started finishes at once, so the API always moves from where the deck really is. Note that `position` and `goto` count slides from 0 while the hash counts from 1.

`ready()` waits until no component holds the slide with `useReadyHold`, web fonts have loaded, and every image and CSS background image on the slide has loaded or failed. Steps that register late are counted by then, so `stepCount` is final, and a step `goto` asked for early has been applied. A failed image does not reject: the broken image shows up in the screenshot instead. After 30 seconds `ready()` rejects with an error that starts `ready() gave up after 30s:` and names what it was still waiting for, such as the slides still held. Late-loading TSX calls `useReadyHold(true)` until its content is in and `false` after; see [static mode and readiness](https://sandrinodm.github.io/deckster/concepts/static-mode-and-readiness/).

## Example

Against `deck dev hello` (the `hello` deck copied into the workspace), opened at `http://localhost:5173/?static`, in the browser console or a Playwright `page.evaluate`:

```js
await window.__deck.ready();
window.__deck.slides.map((slide) => [slide.id, slide.stepCount]);
// [["title",1],["steps",4],["live-counter",2],["closing",1]]
window.__deck.goto('steps', 2);
window.__deck.position; // {"slide":1,"step":2}
location.hash; // "#/2/2"
window.__deck.goto('nope');
// RangeError: No slide with id "nope". Slide ids: title, steps, live-counter, closing.
```

To capture slides as PNG files without writing a script, use [`deck shot`](https://sandrinodm.github.io/deckster/review/screenshots/).

Source: https://sandrinodm.github.io/deckster/reference/deck-api/index.mdx
