Skip to content

Commit

Permalink
web: Added alert when running in Firefox private mode
Browse files Browse the repository at this point in the history
  • Loading branch information
WerWolv committed Oct 4, 2023
1 parent a06752b commit 6c773c0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dist/web/source/enable-threads.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ if(typeof window === 'undefined') {
(async function() {
if(window.crossOriginIsolated !== false) return;

if (!('serviceWorker' in navigator)) {
alert("Your browser doesn't support service workers.\nIf you're using Firefox, you need to not be in a private window.")
}

let registration = await navigator.serviceWorker.register(window.document.currentScript.src).catch(e => console.error("COOP/COEP Service Worker failed to register:", e));
if(registration) {
console.log("COOP/COEP Service Worker registered", registration.scope);
Expand Down

0 comments on commit 6c773c0

Please sign in to comment.