mirror of
https://github.com/a2nt/silverstripe-progressivewebapp.git
synced 2024-10-22 11:05:45 +02:00
9 lines
295 B
JavaScript
9 lines
295 B
JavaScript
if ('serviceWorker' in navigator) {
|
|
var baseHref = (document.getElementsByTagName('base')[0] || {}).href;
|
|
if(baseHref){
|
|
navigator.serviceWorker.register(baseHref + 'service-worker.js').then(function() {
|
|
//console.log('Service Worker Registered');
|
|
});
|
|
}
|
|
}
|