Register the Service Worker

This commit is contained in:
Serdar KÖKTAŞ 2020-01-12 23:31:11 +03:00
parent 794ef99609
commit ced64485ad
1 changed files with 16 additions and 1 deletions

View File

@ -27,4 +27,19 @@
<p class="caption">Powered by <a href="https://gohugo.io/" rel="noreferrer">Hugo</a> and the <a href="https://github.com/zzossig/hugo-theme-zzo" rel="noreferrer">Zzo theme</a></p> <p class="caption">Powered by <a href="https://gohugo.io/" rel="noreferrer">Hugo</a> and the <a href="https://github.com/zzossig/hugo-theme-zzo" rel="noreferrer">Zzo theme</a></p>
{{ end }} {{ end }}
</div> </div>
</footer> </footer>
<script>
if('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/sw.js', { scope: '/' })
.then(function(registration) {
console.log('Service Worker Registered');
});
navigator.serviceWorker
.ready
.then(function(registration) {
console.log('Service Worker Ready');
});
}
</script>