diff --git a/apps/solidcraft-web/Cargo.toml b/apps/solidcraft-web/Cargo.toml index db51d3dc..db27ddaf 100644 --- a/apps/solidcraft-web/Cargo.toml +++ b/apps/solidcraft-web/Cargo.toml @@ -29,5 +29,5 @@ web-sys = { version = "0.3", features = [ "Window", "Document", "Element", "HtmlElement", "HtmlCanvasElement", "Location", "Navigator", "StorageManager", "FileSystemHandle", "FileSystemDirectoryHandle", "FileSystemFileHandle", "FileSystemGetFileOptions", "FileSystemWritableFileStream", "WritableStream", "File", "FileList", "Blob", "BlobPropertyBag", "Url", "HtmlAnchorElement", "HtmlInputElement", "Storage", - "BeforeUnloadEvent", "Event", "EventTarget", "Response", + "BeforeUnloadEvent", "Event", "EventTarget", "Response", "MediaQueryList", ] } diff --git a/apps/solidcraft-web/index.html b/apps/solidcraft-web/index.html index 1a671690..aa66df9a 100644 --- a/apps/solidcraft-web/index.html +++ b/apps/solidcraft-web/index.html @@ -23,6 +23,15 @@ + + + + + + + + +
@@ -32,6 +41,10 @@ if ("serviceWorker" in navigator) { addEventListener("load", () => navigator.serviceWorker.register("sw.js").catch(() => {})); } + // Install as an app: the browser's offer can come before the app runs, so it is kept here for + // the app's File ▸ Install app… item (src/install.rs). Installed, the browser makes no more offers. + addEventListener("beforeinstallprompt", (e) => { e.preventDefault(); window.solidcraftInstall = e; }); + addEventListener("appinstalled", () => { window.solidcraftInstall = null; });