summaryrefslogtreecommitdiff
path: root/misc/dist/html/editor.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/editor.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/editor.html')
-rw-r--r--misc/dist/html/editor.html20
1 files changed, 18 insertions, 2 deletions
diff --git a/misc/dist/html/editor.html b/misc/dist/html/editor.html
index 535721f418..3bf87f3506 100644
--- a/misc/dist/html/editor.html
+++ b/misc/dist/html/editor.html
@@ -2,8 +2,18 @@
<html xmlns='http://www.w3.org/1999/xhtml' lang='' xml:lang=''>
<head>
<meta charset='utf-8' />
- <meta name='viewport' content='width=device-width, user-scalable=no' />
+ <meta name='viewport' content='width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no' />
+ <meta name="mobile-web-app-capable" content="yes" />
+ <meta name="apple-mobile-web-app-capable" content="yes" />
+ <meta name="application-name" content="Godot" />
+ <meta name="apple-mobile-web-app-title" content="Godot" />
+ <meta name="theme-color" content="#478cbf" />
+ <meta name="msapplication-navbutton-color" content="#478cbf" />
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
+ <meta name="msapplication-starturl" content="/latest" />
<link id='-gd-engine-icon' rel='icon' type='image/png' href='favicon.png' />
+ <link rel="apple-touch-icon" type="image/png" href="favicon.png" />
+ <link rel="manifest" href="manifest.json" />
<title>Godot Engine Web Editor (@GODOT_VERSION@)</title>
<style>
*:focus {
@@ -250,7 +260,13 @@
<div id='status-notice' class='godot' style='display: none;'></div>
</div>
</div>
-
+ <script>
+ window.addEventListener("load", () => {
+ if ("serviceWorker" in navigator) {
+ navigator.serviceWorker.register("service.worker.js");
+ }
+ });
+ </script>
<script src='godot.tools.js'></script>
<script>//<![CDATA[