Zum Inhalt springen
DeutschlandGPT

Preview

See a running dev server inside the app, check it at tablet and phone size, point at an element, and let the assistant look at the result itself

The Preview tab shows a running web project inside the app, so you do not have to alt-tab to a browser to see whether the change worked.

Starting it

Three ways in:

WayWhen
Start serverThe project is there and the app works out how to launch it
Create web appThe shared folder holds no project yet
Enter an addressThe server is already running, or it runs somewhere else

The address field takes localhost:3000, a full URL, or the address of a server in your local network. The address is remembered per project. Pages on the public internet do not open in the preview; Open in browser shows them.

The assistant can open the preview too, either on a dev-server address or on a static file such as an HTML page, an SVG, an image or a PDF from a shared folder.

Servers in your local network

The preview also shows pages from a server in your company network, so you can check the login and the rendering of an internal application. It accepts a host only when every address it resolves to is private: 10.x, 172.16.x to 172.31.x, 192.168.x, link-local addresses, the VPN range 100.64.x or a local IPv6 address. A name that resolves to a public address stays blocked, and so do the metadata addresses of cloud providers such as 169.254.169.254.

  • Typing such an address in the address field approves that host. The assistant may then open it as well.
  • If the assistant wants to open a host you have not approved, it asks first. Always allow for saves the approval for that host.
  • Clicking, filling in fields and running code on such a page ask in the same way, because they act in a company system with your login. Plan mode refuses them.
  • Reading such a page (screenshot, page content, console, network requests) needs no further approval once the host is approved.
  • In the Auto mode an automatic check decides instead of a card.
  • A rule from your organization or from your settings can block a host. It then applies to the address field and to the assistant.

The login of such a page is kept by the app, not by the page: its cookies are not visible to the page's own scripts (document.cookie), and a cookie a script sets itself lasts only as long as that page and is not sent to the server. What a page stores in the browser itself (local storage, for example) stays in the app under an address the preview does not use again; other programs on this computer can still reach that data.

While the page is shown, its login stays open in the app. Other programs on your computer, including ones the assistant starts, could in principle use it during that time. The app therefore ends the login when the preview leaves that host. While the assistant runs a turn in Auto or Accept edits, in any conversation, or a command or sub-agent it started there still runs in the background, the page gets no login at all, and the app clears it when that begins, so you log in again afterwards. Programs that were started earlier and keep running on their own are not covered by this. A script inside an empty or inline frame of the page itself can still read and set the cookies the app's browser keeps for local addresses, such as those of a dev server on this device. Log out or close the preview when you are done.

HTTPS works with certificates your system trusts. Self-signed certificates do not work. WebSocket connections to an HTTPS server do not reach the page, and server-sent events may arrive delayed. A login that redirects to a different host (single sign-on) shows an error in the frame, and a server that asks for HTTP authentication (user name and password in a browser dialog) is not supported. Open such pages in your browser.

Servers in the local network need a current web engine: on macOS the WebKit of Safari 16.4 or newer (macOS 13.3 or newer), on Linux a current WebKitGTK. With an older one the preview shows a message saying so.

When nothing appears

The tab checks whether the address answers before it shows a frame, so an empty white area is never left unexplained:

MessageCause
No server is respondingNothing is listening on that address. The assistant or the terminal can start one
Can't be embeddedThe site refuses to be shown in a frame. Only the site itself can allow that, so open it in your browser
The server reported no addressIt started but printed nothing recognisable, for example a custom logger. Type the address in yourself
Public internetThe host resolves to a public address. Open it in your browser
Name cannot be resolvedThe name has no address. Check the spelling and your connection to the company network or the VPN
A rule blocks itA rule from your organization or your settings blocks this host for the preview

Open in browser is always there.

Developer tools

Developer tools in the preview toolbar opens the page the preview shows in a separate window together with the browser's developer tools: elements, console, network and storage. It works for a dev server on this device, for a server in the local network and for an HTML file from a shared folder. The window stays on that address: a link to another address does not open there, use Open in browser for it.

The page in that window keeps the login of the preview. On some Linux distributions the developer tools stay empty, because the system's WebKitGTK ships without its inspector files. Open in browser is the way out there.

Viewport sizes

Switch between Desktop, Tablet and Mobile, and rotate the orientation. Tablet and phone render in a fixed frame at common device dimensions, so a responsive layout can be checked without resizing the window.

Selecting an element

Select element turns the preview into a picker. Click an element in the page and it is attached to your next message, so you can write "make this narrower" instead of describing where "this" is. Click it again to deselect it. Up to eight elements at once.

This is the fastest way to point at something in a page you did not write, or whose class name you do not know.

What the assistant can see

Two tools make the difference between an assistant that guesses and one that checks:

  • A screenshot of the preview. The assistant takes an image of the currently loaded page and looks at it. The image also appears in the conversation, which is your evidence that it really looked rather than claiming it did.
  • The browser console of that page. Errors and warnings from the running page, filterable by level. This is how a runtime error that never shows up in the terminal gets found.

The console log is cleared when the preview navigates or reloads, so it never reports the errors of the previous page.

"Fix the layout on the about page" therefore becomes a loop the assistant can close on its own: change the file, reload, screenshot, look, adjust. Ask it to check the result and it will.

Cowork has no preview tab

In Cowork documents are rendered inside the editor tab rather than in a separate preview tab, because for a document the preview and the thing you would edit are the same file. There is no address field, no dev server and no element picker there. That is all Code.

Was this page helpful?