Installable as an app (PWA): manifest, pixel-art icons, offline service worker
- manifest.webmanifest (full screen, any orientation), icons 192/512/maskable/apple-touch - sw.js: network first, cache as offline fallback, the savegame API is never cached - registered only over HTTPS or on localhost; nginx serves the manifest type - README: installing, HTTPS requirement Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b8bf2b8503
commit
44b938f0e5
9 files changed
+85
-1
No files matched your search
+12
-1
@@ -3,7 +3,14 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>DungeonCraft</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="theme-color" content="#080608">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="manifest" href="manifest.webmanifest">
|
||||
<link rel="icon" type="image/png" href="icons/icon-192.png">
|
||||
<link rel="apple-touch-icon" href="icons/apple-touch-icon.png">
|
||||
<style>
|
||||
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: #080608; }
|
||||
canvas { display: block; width: 100%; height: 100%; outline: none; image-rendering: pixelated; }
|
||||
@@ -17,6 +24,10 @@
|
||||
<script>
|
||||
document.getElementById("glcanvas").focus();
|
||||
load("dungeoncraft.wasm");
|
||||
// installable app (PWA): only over HTTPS or on localhost
|
||||
if ("serviceWorker" in navigator && (location.protocol === "https:" || location.hostname === "localhost")) {
|
||||
navigator.serviceWorker.register("sw.js").catch(function () {});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user