Skip to Content

Browser

The browser pane shows a live preview of your frontend app running in real time.

Live Preview

Frontend apps (React, Vue, Svelte, Angular, HTML, JavaScript, TypeScript) run inside a sandboxed iframe. The preview updates automatically as you edit code.

Phone view: the phone button next to the preview’s address shows your app in a phone-sized frame, so you can check how it looks on a small screen. In phone view the same button shows a monitor; click it to go back.

On a phone: the chat and the preview take turns. Use Chat | Preview at the top to switch; your app keeps running while you’re in the chat. With Advanced Mode on, tabs at the top switch between Chat, Code, Preview and Console (Output for programs); tap the first tab again to open Files, Search and the other side panels. When your app throws an error, the Console tab shows it in a card with the file and line; Go to line opens the code there, and Ask AI to fix sends it to the chat. In a project, a row of keys under the terminal gives you Esc, Tab, Ctrl and the arrow keys.

Hot Reload

By default cdbx rebundles your code after 1 second of inactivity in the editor. The iframe resets and runs the new bundle within ~50ms. You can adjust the inactivity delay in the editor preferences panel.

Error Handling

Build Errors

If bundling fails (a syntax error, missing import, etc.) the preview pane shows a red Bundling Error overlay with the error message and a Retry button. The error is also shown in the AI Chat’s Fix error button — click it to send the error directly to the AI.

Runtime Errors

If your code throws a JavaScript error at runtime (unhandled exception or unhandled promise rejection), cdbx catches it and:

  1. Shows a red Runtime Error overlay in the preview pane with the error message
  2. Surfaces a Fix error button in the AI Chat input — click it to send the error to the AI for automatic fixing

Runtime errors are relayed from the iframe to the parent page via postMessage and recorded in the log store, which is what triggers the Fix error button.

Infinite Loop Detection

For frontend templates that run user code via eval (React, Vue, Svelte, Preact, JavaScript, TypeScript), cdbx starts a 5-second watchdog timer when the code bundle is sent to the iframe. If the iframe doesn’t signal that execution finished within 5 seconds, an Infinite Loop Detected overlay appears with a Reload Preview button. This stops a runaway loop from freezing the browser.

Console Output

You can control where console.log output goes using the Console Output setting in editor preferences:

  • DevTools (default) — console output is captured by the embedded DevTools panel (Chii/Chobitsu)
  • Browser — console output is routed to the native browser DevTools (F12), useful when you want full browser inspector access

DevTools Panel

cdbx includes an embedded Chrome DevTools panel powered by Chii  and Chobitsu . Open it via the DevTools tab in the right panel. It provides:

  • Console with full log/warn/error output
  • Elements inspector
  • Source inspection

Controllers, USB devices and sound

Apps can connect a USB device, such as a game controller, with WebUSB, read a gamepad with the Gamepad API, and play sound without waiting for a click. This works in the editor’s preview and in published apps. With USB, the browser always asks the person to choose the device first.

Sandbox Security

Your app always runs in a sandboxed frame, but the editor’s preview and a published app are set up differently.

In the editor, the preview frame includes allow-same-origin, so your app can use things like its own storage. Most apps (React, Vue, Svelte, JavaScript and TypeScript) load from a separate preview address, so their code can’t reach the editor page, your sign-in or cdbx’s storage. Angular apps, HTML pages, Slides, Docs, and apps whose index.html head or body you’ve edited still load on cdbx’s own address in the editor.

A published app runs with sandbox="allow-scripts allow-forms allow-modals allow-popups" and no allow-same-origin. Its code can’t reach the page around it, or cdbx’s storage and cookies.

Last updated on