# Browser and desktop

Open a VM's Linux desktop to watch Chrome work, or run Chrome headless from a program and copy a screenshot out.

Source: https://slashinfra.com/docs/platform/browser-and-desktop
Last modified: 2026-11-30T16:36:19.000Z

Every VM on the default image has Chrome and a Linux desktop on display `:1`; you can drive Chrome headless from a program or open the same screen to watch or take over. When the VM sleeps, a running desktop or browser keeps it in memory instead of on disk; stop it when you are done.

The samples use a VM named `browser`. [VMs](https://slashinfra.com/docs/platform/vms) shows how to create it.

## Open the desktop

Port 6080 serves the desktop’s noVNC page. The first visit starts a 1280x800 screen with the Openbox window manager; nothing of it runs before that visit.

### Dashboard

- Open the [dashboard](https://app.slashinfra.com/svms). 
- Select `browser` in the list. 
- Select Desktop. The first visit starts the desktop in a new tab.

### CLI

```bash
si svm desktop browser
```

Output

```text
https://6080-6f1c0f0e8a.slashinfra.dev/vnc.html?autoconnect=1&resize=remote
```

Open the address.

A member of the organization signs in once, and the browser keeps the session for 24 hours or until sign-out. Port 6080 follows the access levels of [Web addresses](https://slashinfra.com/docs/platform/web-addresses). By default it is `authenticated` without a port row, so it does not appear in `si port ls`: members reach it, and a link for port 6080 admits anyone you share it with.

Every command in the VM sees `DISPLAY=:1`. While the desktop runs, a headed program such as `google-chrome --no-sandbox` appears on this screen, and so do `xterm`, `xdotool` and `xclip`. `desktop screenshot` writes a PNG of the screen, and `desktop stop` ends the desktop.

To choose another size, stop the desktop and start it with a width and height:

```bash
si exec browser -- desktop stop
si exec browser -- desktop start 1920x1080
```

Output

```text
desktop: stopped
Desktop: https://6080-6f1c0f0e8a.slashinfra.dev/vnc.html?autoconnect=1&resize=remote
DISPLAY=:1; VNC on 127.0.0.1:5900
```

## Run a headless browser

A headless browser uses no desktop. The image installs Chrome, Playwright with Chromium, the Playwright CLI and the Playwright MCP server. Use the Playwright library in your own Node program, `playwright-cli` for a shell, `browser cdp` for a client that speaks the DevTools protocol, or `browser mcp` for a client without a shell. `si exec browser -- playwright-cli open https://example.com` opens a page from a shell, and `si exec browser -- playwright-cli snapshot` prints it with refs to click.

A Node program finds the global Playwright package with `NODE_PATH=/usr/local/lib/node_modules`. This program opens a page and writes a screenshot:

```bash
si exec browser -- env NODE_PATH=/usr/local/lib/node_modules node -e '
const { chromium } = require("playwright");
(async () => {
const browser = await chromium.launch({ args: ["--no-sandbox"] });
const page = await browser.newPage({ viewport: { width: 1280, height: 800 } });
await page.goto("https://example.com");
await page.screenshot({ path: "example.png" });
console.log(await page.title());
await browser.close();
})();
'
```

Output

```text
Example Domain
```

Copy the screenshot to your laptop. `si cp` prints nothing when the copy succeeds, so `file` confirms the result:

```bash
si cp browser:example.png ./example.png
file example.png
```

Output

```text
example.png: PNG image data, 1280 x 800, 8-bit/color RGB, non-interlaced
```

## Start a browser endpoint

`browser cdp` starts a headless Chrome with the DevTools protocol on port 9222, for a tool that connects over CDP. `browser mcp` starts the Playwright MCP server on port 8931 at `/mcp`, for a client without a shell.

```bash
si exec browser -- browser cdp
si exec browser -- browser mcp
```

Output

```text
Chrome DevTools protocol: https://9222-6f1c0f0e8a.slashinfra.dev
playwright: chromium.connectOverCDP('https://9222-6f1c0f0e8a.slashinfra.dev')
Playwright MCP (streamable HTTP): https://8931-6f1c0f0e8a.slashinfra.dev/mcp
```

Both addresses are preview addresses. The CDP address accepts Playwright’s `chromium.connectOverCDP` or Puppeteer. The MCP address is the streamable HTTP endpoint. Stop both with:

```bash
si exec browser -- browser stop
```

Output

```text
browser: stopped
```

## What a sleep does

| What runs | A sleep keeps | After the wake |
| --- | --- | --- |   
| Desktop open | The screen and its windows in memory | Reopen the address; the viewer reconnects to the same screen. | 
| Headless browser | Chrome and its page in memory | Reconnect with your program; the page is still there. | 
| No user process, and no service declares a port | The files and installed packages on disk | The next start is a fresh VM. |

Open connections end when the VM sleeps. A viewer or browser client reconnects on its next request, and that request wakes the VM. Opening the desktop address, `si exec` and `si cp` wake a sleeping VM. A sleep on disk starts only when no user process remains and no service declares a port, so a running desktop or browser prevents it. `si svm stop` ends the processes and keeps the disk; a delete removes the disk too.

## Options

| Field | Type | Default | Allowed values | What it changes |
| --- | --- | --- | --- | --- |   
| `SVM` (argument) | string | The VM set with `si use`, or the only VM | A VM name, or its id | The VM that runs the desktop or browser. | 
| `--project` | string | `default` | A project name, or its `proj_` id | The project that holds the VM. | 
| `WIDTHxHEIGHT` (argument of `desktop start`) | string | `1280x800` | `^[0-9]{3,4}x[0-9]{3,4}$` | The size of the desktop screen. |

## Errors

| Code | When | Fix |
| --- | --- | --- |   
| [`not_supported_by_image`](https://slashinfra.com/docs/reference/errors#not_supported_by_image) | The VM runs the postgres image, which has no desktop. | Use the default image. | 
| [`svm_not_found`](https://slashinfra.com/docs/reference/errors#svm_not_found) | The name or id matches no VM in the project. | Check the name and the project. |

Errors that any request can return are in the [error catalog](https://slashinfra.com/docs/reference/errors).

## Permissions

Any member opens the desktop. A link for port 6080 admits anyone you share it with, and creating the link takes `svm:read`.

| Operation | Who can | Key action |
| --- | --- | --- |   
| Open the desktop | Any member | `svm:read` | 
| Start or stop the desktop | Any member | `svm:exec` | 
| Run a headless browser | Any member | `svm:exec` | 
| Copy a screenshot | Any member | `svm:read` | 
| Create a link for port 6080 | Any member | `svm:read` |

## Limits

- The desktop starts at 1280x800. `desktop start` takes a width and height of 3 or 4 digits each. 
- The desktop uses display `:1`, and every command in the VM sees `DISPLAY=:1`. 
- An idle desktop viewer connection closes after about 100 seconds without traffic. Reload the page to reconnect. 
- A VM accepts 64 preview connections at once, the desktop included; more answer 429. 
- The desktop has no GPU and no sound. It suits browsers, editors and office work, not 3D or video. 
- Port 6080 needs the default image, and a link for it gives full control of the VM; a postgres VM answers 409 `not_supported_by_image`. Share the link only with someone you would trust with your organization key.

The full list is in [Limits](https://slashinfra.com/docs/reference/limits).

## Next

- [Web addresses](https://slashinfra.com/docs/platform/web-addresses): the access levels, links and port 6080. 
- [Sleep and wake](https://slashinfra.com/docs/how/sleep-and-wake): what a memory sleep keeps and what wakes the VM. 
- [Grants](https://slashinfra.com/docs/platform/grants): share the VM’s API without an account.
