diff options
| author | Christine Dodrill <me@christine.website> | 2018-10-20 13:17:13 -0700 |
|---|---|---|
| committer | Christine Dodrill <me@christine.website> | 2018-10-20 13:24:18 -0700 |
| commit | df2301f496ce0bd81bc8967fb27d49f7c76fe948 (patch) | |
| tree | 0df2774761c4f5be5b9d3418a5aba0b5ebcc63df /templates/base.html | |
| parent | cb2d716b38ca330b4d183a47ff9a8142fdf58c7f (diff) | |
| download | xesite-df2301f496ce0bd81bc8967fb27d49f7c76fe948.tar.xz xesite-df2301f496ce0bd81bc8967fb27d49f7c76fe948.zip | |
static: support offline page service worker
Diffstat (limited to 'templates/base.html')
| -rw-r--r-- | templates/base.html | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/templates/base.html b/templates/base.html index 52a98fc..4bdea31 100644 --- a/templates/base.html +++ b/templates/base.html @@ -62,6 +62,17 @@ <footer> <blockquote>Copyright 2018 Christine Dodrill. Any and all opinions listed here are my own and not representative of my employer.</blockquote> </footer> + <script> + if (navigator.serviceWorker.controller) { + console.log("Active service worker found, no need to register"); + } else { + navigator.serviceWorker.register("/static/js/pwabuilder-sw.js", { + scope: "https://christine.website/" + }).then(function(reg) { + console.log("Service worker has been registered for scope:" + reg.scope); + }); + } + </script> </div> </body> </html> |
