diff options
author | luxagraf <sng@luxagraf.net> | 2018-11-29 19:21:04 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2018-11-29 19:21:04 -0600 |
commit | b5fb96e3830782432c0fe2f3e7d23ba62abc8e33 (patch) | |
tree | 29e8615aea2cceab5a9d351b1e52620febea0a8d | |
parent | 7cf19cf20663b2d6bf3626e2ac3658468985fc5a (diff) |
added service worker to luxagraf
-rw-r--r-- | design/templates/base.html | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/design/templates/base.html b/design/templates/base.html index dd2292a..a96d76e 100644 --- a/design/templates/base.html +++ b/design/templates/base.html @@ -81,6 +81,20 @@ </footer> </div> {% block js %}{% endblock%} +<script> +// Register our service-worker +if (navigator.serviceWorker) { + window.addEventListener('load', function() { + if (navigator.serviceWorker.controller) { + navigator.serviceWorker.controller.postMessage({'command': 'trimCaches'}); + } else { + navigator.serviceWorker.register('/media/js/serviceworker.js', { + scope: '/' + }); + } + }); +} +</script> {%comment%} <!-- Piwik --> <script type="text/javascript"> |