summaryrefslogtreecommitdiff
path: root/swayback/templates/sw.html
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2018-02-25 15:46:33 +0100
committerLars-Dominik Braun <lars@6xq.net>2018-02-25 15:46:33 +0100
commitf6d405ced3e9330195109f7c0cef1d40863b1dd0 (patch)
tree473204f94a5305530412bc2da9fb7c12f67f6394 /swayback/templates/sw.html
downloadswayback-f6d405ced3e9330195109f7c0cef1d40863b1dd0.tar.gz
swayback-f6d405ced3e9330195109f7c0cef1d40863b1dd0.tar.bz2
swayback-f6d405ced3e9330195109f7c0cef1d40863b1dd0.zip
Initial import
Diffstat (limited to 'swayback/templates/sw.html')
-rw-r--r--swayback/templates/sw.html41
1 files changed, 41 insertions, 0 deletions
diff --git a/swayback/templates/sw.html b/swayback/templates/sw.html
new file mode 100644
index 0000000..2abfac2
--- /dev/null
+++ b/swayback/templates/sw.html
@@ -0,0 +1,41 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <title>Just a second…</title>
+ <meta name="description" content="">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <style>
+ .hidden {
+ display: none;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="hidden" id="unsupported">
+ <p>Service workers are not supported by your browser.</p>
+ </div>
+ <div id="waiting">
+ <p>Just a second…</p>
+ </div>
+ <script>
+ if ('serviceWorker' in navigator) {
+ /* service workers must be hosted in the same origin (i.e. subdomain) */
+ navigator.serviceWorker.register('/static/sw.js', {scope: '/'})
+ .then(function(reg) {
+ /* load actual content using the service worker */
+ window.location.reload ();
+ }).catch(function(error) {
+ console.log ('sw error', error);
+ document.getElementById ('unsupported').classList.remove ('hidden');
+ document.getElementById ('waiting').classList.add ('hidden');
+ });
+ } else {
+ console.log ('not supported');
+ document.getElementById ('unsupported').classList.remove ('hidden');
+ document.getElementById ('waiting').classList.add ('hidden');
+ }
+ </script>
+ </body>
+</html>