You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This requires a :ref:`secure context <doc_javascript_secure_contexts>`,
205
+
while also requiring the following CORS headers to be set when serving the files:
206
+
207
+
::
208
+
209
+
Cross-Origin-Opener-Policy: same-origin
210
+
Cross-Origin-Embedder-Policy: require-corp
211
+
212
+
If you don't control the web server or are unable to add response headers,
213
+
use `coi-serviceworker <https://github.com/gzuidhof/coi-serviceworker>`__
214
+
as a workaround.
215
+
216
+
If the client doesn't receive the required response headers,
217
+
**the project will not run**.
218
+
206
219
The generated ``.html`` file can be used as ``DirectoryIndex`` in Apache
207
-
servers and can be renamed to e.g. ``index.html`` at any time, its name is
220
+
servers and can be renamed to e.g. ``index.html`` at any time. Its name is
208
221
never depended on by default.
209
222
210
223
The HTML page draws the game at maximum size within the browser window.
211
-
This way it can be inserted into an ``<iframe>`` with the game's size, as is
224
+
This way, it can be inserted into an ``<iframe>`` with the game's size, as is
212
225
common on most web game hosting sites.
213
226
214
227
The other exported files are served as they are, next to the ``.html`` file,
@@ -223,23 +236,17 @@ The ``.pck`` file is binary, usually delivered with the MIME-type
223
236
:mimetype:`application/octet-stream`. The ``.wasm`` file is delivered as
224
237
:mimetype:`application/wasm`.
225
238
226
-
.. caution:: Delivering the WebAssembly module (``.wasm``) with a MIME-type
227
-
other than :mimetype:`application/wasm` can prevent some start-up
228
-
optimizations.
229
-
230
-
.. tip::
231
-
Godot 4 web exports use the `SharedArrayBuffer <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer>`__, and require the following CORS headers to be set when serving the files:
232
-
233
-
::
234
-
Cross-Origin-Opener-Policy: same-origin
235
-
Cross-Origin-Embedder-Policy: require-corp
236
-
239
+
.. warning::
237
240
241
+
Delivering the WebAssembly module (``.wasm``) with a MIME-type
242
+
other than :mimetype:`application/wasm` can prevent some start-up
243
+
optimizations.
238
244
239
245
Delivering the files with server-side compression is recommended especially for
240
-
the ``.pck`` and ``.wasm`` files, which are usually large in size.
241
-
The WebAssembly module compresses particularly well, down to around a quarter
242
-
of its original size with gzip compression.
246
+
the ``.pck`` and ``.wasm`` files, which are usually large in size. The
247
+
WebAssembly module compresses particularly well, down to around a quarter of its
248
+
original size with gzip compression. Consider using Brotli precompression if
249
+
supported on your web server for further file size savings.
243
250
244
251
**Hosts that provide on-the-fly compression:** GitHub Pages (gzip)
0 commit comments