summaryrefslogtreecommitdiff
path: root/misc/dist/html/offline.html
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-03-08 15:39:14 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-03-08 17:06:24 +0100
commitd8bd54fbf2c3d10ece692da1a9b47e766cc95fee (patch)
treefd094e00d1784378d291aa8be72056356e56df75 /misc/dist/html/offline.html
parent0816011e86a5ec4dba8e551d602afdbd6b874a09 (diff)
[HTML5] Add PWA support to the editor page.
This allows to install it as an app, and provide offline support (after the first run). Practically, this boils down to adding a JSON file as a manifest, an offline page to be displayed when the cached files are not avaialble, and a JS file to cache resources and return them. The reason for the "first run requirements" is that some browsers, will emit an "install" by just visiting the page (to see if the JS code is compatibile), and we do not want to force casual visitors to just download the 10 MiB+ compressed editor WebAssembly file without pressing the start button. Special thanks to Hugo Locurcio (Calinou) for the initial work.
Diffstat (limited to 'misc/dist/html/offline.html')
-rw-r--r--misc/dist/html/offline.html42
1 files changed, 42 insertions, 0 deletions
diff --git a/misc/dist/html/offline.html b/misc/dist/html/offline.html
new file mode 100644
index 0000000000..000c21b4d3
--- /dev/null
+++ b/misc/dist/html/offline.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>You are offline</title>
+ <style>
+ html {
+ background-color: #333b4f;
+ color: #e0e0e0;
+ }
+
+ body {
+ font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+ margin: 2rem;
+ }
+
+ p {
+ margin-block: 1rem;
+ }
+
+ button {
+ display: block;
+ padding: 1rem 2rem;
+ margin: 3rem auto 0;
+ }
+ </style>
+</head>
+<body>
+ <h1>You are offline</h1>
+ <p>This application requires an Internet connection to run for the first time.</p>
+ <p>Press the button below to try reloading:</p>
+ <button type="button">Reload</button>
+
+ <script>
+ document.querySelector("button").addEventListener("click", () => {
+ window.location.reload();
+ });
+ </script>
+</body>
+</html>