From 26ad19d89644bbfde063bfcbe57fbd7ffe60368a Mon Sep 17 00:00:00 2001 From: AntonPieper Date: Wed, 21 Feb 2024 12:03:09 +0100 Subject: [PATCH] Add additional cross origin isolation message --- index.html | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 9f22da0..67a0afd 100644 --- a/index.html +++ b/index.html @@ -39,7 +39,8 @@ max-width: 8rem; } - .not-hosted-msg { + .not-hosted-msg, + .no-coi-msg { text-align: center; position: absolute; @@ -87,6 +88,7 @@ const { protocol } = window.location; const isHosted = protocol !== "file:"; + const isCOI = crossOriginIsolated ?? false; let raylibJs = undefined; function startRaylib(selectedWasm){ @@ -96,6 +98,21 @@ raylibExampleSelect.value = selectedWasm; if (isHosted) { + if (!isCOI) { + window.addEventListener("load", () => { + document.body.innerHTML = ` +
+
+

Unfortunately, due to security restrictions, SharedArrayBuffer cannot be used.

+

Please navigate to this location using a web server that has the required headers set.

+

If you have Python 3 on your system you can just do:

+
+ $ python3 ./server.py 6969 +
+ `; + }); + return; + } if (raylibJs !== undefined) { raylibJs.stop(); } @@ -113,7 +130,7 @@

Please navigate to this location using a web server.

If you have Python 3 on your system you can just do:

- $ python3 -m http.server 6969 + $ python3 ./server.py 6969 `; });