Skip to content

Commit 1a33004

Browse files
authored
Merge branch 'main' into auchenberg/new-editor-docs
2 parents 2532507 + 140cd48 commit 1a33004

File tree

7 files changed

+74
-16
lines changed

7 files changed

+74
-16
lines changed

.vitepress/theme/styles/content.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,8 @@
9191
.content-container .VPDocFooter {
9292
margin-top: 30px;
9393
}
94+
95+
.mx-auto {
96+
margin-left: auto !important;
97+
margin-right: auto !important;
98+
}

.vitepress/theme/styles/fixes.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@
220220
margin-top: 40px !important;
221221
}
222222

223+
.vp-doc h2 .header-anchor {
224+
top: 16px;
225+
}
226+
223227
.vp-doc p > strong > a,
224228
.vp-doc p > a,
225229
.vp-doc li > strong > a,
Loading
Loading
Loading
Loading

docs/platform/webcontainers/browser-config.md

Lines changed: 65 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,54 @@ WebContainers use a combination of browser technologies, such as [Service Worker
1616

1717
In some browsers, this feature is blocked by “third-party cookie” or “third-party storage” restrictions. These are legitimate restrictions when the third-party domain is an ad server or a tracking server, but in the case of WebContainers the third-party domain is where your project code runs.
1818

19-
## Chrome: enabling Service Workers {#chrome-service-workers}
19+
## Chrome
2020

21-
If you use the “Block Third Party Cookies” option in Chrome and you have "Third-party Storage Partitioning" disabled, you will need to either:
21+
With Chrome's defaults, starting with version 118 or later, you should get a pretty good experience out of the box.
22+
23+
Read on if you run into issues or want an even smoother experience.
24+
25+
### Previews in a separate tab {#chrome-preview-separate-tab}
26+
27+
Previews opened in a separate tab are not connected by default to the editor and require an extra step. To complete this step, you are usually prompted to click a button.
28+
29+
This can happen automatically if your popups settings, [chrome://settings/content/popups](chrome://settings/content/popups), are adjusted with the following exception:
30+
31+
```
32+
https://[*.]webcontainer.io
33+
```
34+
35+
<img class="mx-auto" alt="Chrome popups settings showing the *.webcontainer.io origins as exceptions" src="./assets/chrome-settings-popups.png" width="800" height="502.37" />
36+
37+
Once done, whenever the preview needs to reconnect to the editor, it will open a popup that gets immediately closed.
38+
39+
Lastly, if Chrome's [memory saver][CHROME_MEMORY_SAVER] is turned on, this step might be necessary more often than required. To avoid it, you can add the following exception in [chrome://settings/performance](chrome://settings/performance):
40+
41+
```
42+
https://webcontainer.io
43+
https://stackblitz.com
44+
```
45+
46+
Your performance settings should be similar to this:
47+
48+
<img class="mx-auto" alt="Chrome performance settings showing the memory saver section with an exception for stackblitz.com" src="./assets/chrome-memory-saver.png" width="800" height="502.37" />
49+
50+
### Enabling Service Workers {#chrome-service-workers}
51+
52+
If you use the “Block Third Party Cookies” option in Chrome and you have “Third-party Storage Partitioning” disabled, you will need to either:
2253

2354
- Enable Storage partitioning
2455
- Or add exceptions for StackBlitz projects.
2556

2657
The first option should be preferred because this is a [new feature][GOOGLE_SP] of Chrome which improves your privacy when you visit websites that embed third-party sites.
2758

28-
### Enable Storage partitioning
59+
#### Enable Storage partitioning
2960

3061
Visit `chrome://flags/#third-party-storage-partitioning` and choose `Enabled` in the drop down. In recent version of Chrome, choosing the `Default` value should work too.
3162

32-
<img alt="Chrome flags showing the third-party Storage Partitioning option enabled." src="./assets/chrome-enable-sp.png" width="800" />
63+
<img alt="Chrome flags showing the third-party Storage Partitioning option enabled." src="./assets/chrome-enable-sp.png" width="800" height="234.56" />
3364

3465

35-
### Or add exceptions for Stackblitz
66+
#### Or add exceptions for Stackblitz
3667

3768
To allow all StackBlitz projects to use Service Workers, go to your browser’s cookie preferences, and add exceptions for the following URL patterns:
3869

@@ -43,11 +74,11 @@ https://[*.]webcontainer.io
4374

4475
For instance, in Chrome, go to `chrome://settings/cookies` and add those exceptions in the “Sites that can always use cookies” section.
4576

46-
<img alt="Chrome cookie settings with an empty list of “Sites that can always use cookies”." src="./assets/chrome-settings-cookies-1.png" width="800" />
77+
<img alt="Chrome cookie settings with an empty list of “Sites that can always use cookies”." src="./assets/chrome-settings-cookies-1.png" width="800" height="600" />
4778

48-
<img alt="Chrome cookie settings showing a modal dialog for adding a site to list of third-party cookie exceptions." src="./assets/chrome-settings-cookies-2.png" width="800" />
79+
<img alt="Chrome cookie settings showing a modal dialog for adding a site to list of third-party cookie exceptions." src="./assets/chrome-settings-cookies-2.png" width="800" height="600" />
4980

50-
<img alt="Chrome cookie settings with exceptions for stackblitz.io and local.webcontainer.io domains." src="./assets/chrome-settings-cookies-3.png" width="800" />
81+
<img alt="Chrome cookie settings with exceptions for stackblitz.io and local.webcontainer.io domains." src="./assets/chrome-settings-cookies-3.png" width="800" height="600" />
5182

5283
:::details Advanced: enabling Service Workers for a single project
5384

@@ -67,7 +98,9 @@ Note that the list of blocked domains might look different for you. In particula
6798

6899
:::
69100

70-
## Firefox: enabling Service Workers {#firefox-service-workers}
101+
## Firefox
102+
103+
### Enabling Service Workers {#firefox-service-workers}
71104

72105
When Firefox’s Enhanced Tracking Protection is configured in “Custom” mode with the cookie blocking option set to “All cross-site cookies”, Firefox will block the Service Workers used by WebContainers.
73106

@@ -81,7 +114,8 @@ To do so, visit `about:preferences#privacy` to check what your current settings
81114
<img
82115
alt="The Firefox “Privacy & Security” settings page showing that Enhanced Tracking Protection is set to “Custom”, and to “Cookies: All cross-site cookies (may cause websites to break)”."
83116
src="./assets/firefox-settings-cookies-1.png"
84-
width="1024"
117+
width="820"
118+
height="661"
85119
/>
86120

87121
To add exceptions for StackBlitz, scroll down to the “Cookies and Site Data” section, click on “Manage Exceptions…”, and add exceptions for the following sites:
@@ -94,11 +128,25 @@ https://webcontainer.io
94128
<img
95129
alt="The Cookies and site data exceptions management window in Firefox settings. It shows a couple entries for stackblitz.io and webcontainer.io, both with the value “Allow”."
96130
src="./assets/firefox-settings-cookies-2.png"
97-
width="1024"
131+
width="820"
132+
height="645"
98133
/>
99134

100135
Don’t forget to click “Save Changes”. Then you should be able to reload the tab with your StackBlitz project, and hopefully everything should work!
101136

137+
### Previews in a separate tab {#firefox-preview-separate-tab}
138+
139+
Previews opened in a separate tab are not connected by default to the editor and require an extra step. To complete this step, you are usually prompted to click a button.
140+
141+
This can happen automatically if your popups settings, [about:preferences#privacy](about:preferences#privacy), are adjusted with the following exception:
142+
143+
```
144+
https://webcontainer.io
145+
```
146+
147+
<img alt="Firefox popups settings showing the webcontainer.io site allowed as an exception" src="./assets/firefox-settings-popups.png" width="800" height="649" />
148+
149+
102150
## Brave: enabling Service Workers {#brave-service-workers}
103151

104152
By default, Brave’s “Shields” feature blocks [Service Workers][MDN_SERVICE_WORKER] and cookies from third-party domains.
@@ -107,19 +155,19 @@ To allow WebContainers to run in Brave, you will need to add an exception for St
107155

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

110-
![Screenshot of Brave on a WebContainers project with the Brave Shields feature on. Loading the project’s web server is stuck on the last step.](./assets/brave-stuck-project.png)
158+
<img alt="Screenshot of Brave on a WebContainers project with the Brave Shields feature on. Loading the project’s web server is stuck on the last step" src="./assets/brave-stuck-project.png" width="820" height="500"/>
111159

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

114-
<img alt="Screenshot showing the Shields configuration popup for stackblitz.com." src="./assets/brave-shields-popup.png" width="380" />
162+
<img alt="Screenshot showing the Shields configuration popup for stackblitz.com." src="./assets/brave-shields-popup.png" width="380" height="358" />
115163

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

118-
![Screenshot showing the advanced view of the Shields configuration popup, with a drop-down selector for cross-site cookie permissions.](./assets/brave-shields-details.png)
166+
<img alt="Screenshot showing the advanced view of the Shields configuration popup, with a drop-down selector for cross-site cookie permissions." src="./assets/brave-shields-details.png" width="820" height="559" />
119167

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

122-
![Screenshot of Brave on a WebContainers 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.](./assets/brave-working-project.png)
170+
<img alt="Screenshot of Brave on a WebContainers 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." src="./assets/brave-working-project.png" width="820" height="500"/>
123171

124172
## Edge: enabling WebAssembly {#edge-webassembly}
125173

@@ -143,4 +191,5 @@ stackblitz.com
143191

144192
[MDN_SERVICE_WORKER]: https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API
145193
[MDN_WEB_ASSEMBLY]: https://developer.mozilla.org/en-US/docs/WebAssembly
146-
[GOOGLE_SP]: https://developers.google.com/privacy-sandbox/3pcd/storage-partitioning
194+
[GOOGLE_SP]: https://developers.google.com/privacy-sandbox/3pcd/storage-partitioning
195+
[CHROME_MEMORY_SAVER]: https://support.google.com/chrome/answer/12929150

0 commit comments

Comments
 (0)