| 12345678910111213141516 |
- if ('serviceWorker' in navigator) {
- window.addEventListener('load', function () {
- navigator.serviceWorker.register('/serviceWorker.js').then(function (registration) {
- console.log('ServiceWorker registration successful with scope: ', registration.scope);
- registration.update().then(res => {
- console.log('ServiceWorker registration update: ', res);
- });
- }, function (err) {
- console.error('ServiceWorker registration failed: ', err);
- });
- navigator.serviceWorker.addEventListener('controllerchange', function() {
- console.log('ServiceWorker controllerchange ');
- window.location.reload(true);
- });
- });
- }
|