Skip to main content

Running in Brave

WebContainer works in Brave almost out of the box. However, it might require a small configuration change.

What’s the Problem?#

By default, Brave’s “Shields” feature blocks Service Workers and cookies from third-party domains.

When you visit a WebContainer-enabled project on stackblitz.com, StackBlitz tries to register a Service Worker for the domain <project_name>.stackblitz.io. Since it’s considered a third-party domain, Brave will reject it.

How to Allow Third-Party Service Workers for stackblitz.com#

  1. Visit a WebContainer-based project, for instance https://www.stackblitz.com/edit/nextjs. The project’s boot sequence might stay stuck on the “Running start command” step:

Screenshot of Brave on a WebContainer project with the Brave Shields feature on. Loading the project’s web server is stuck on the last step.

  1. Click on the “Shields” icon at the right of the address bar, then click on “Advanced View”.

Screenshot showing the Shields configuration popup for stackblitz.com.

  1. In the advanced view, change the “Cross-site cookies blocked” option to “All cookies allowed”.

Screenshot showing the advanced view of the Shields configuration popup, with a drop-down selector for cross-site cookie permissions.

Brave will reload the page, and you should get a working project:

Screenshot of Brave on a WebContainer project with the Brave Shields feature tweaked to allow third-party cookies and Service Workers. Loading the web server works, and shows the default page for Next.js’s starter project.