You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw-test/sw.js', { scope: '/sw-test/' }).then(function(reg) {
// registration worked
console.log('Registration succeeded. Scope is ' + reg.scope);
}).catch(function(error) {
// registration failed
console.log('Registration failed with ' + error);
});
};
We know the scope depends on the sw.js file's location, if the path of sw.js is '/sw-test/sw.js', then, the scope should be '/sw-test/'. So why do we need to define a scope attribute seperately?
I found the the scope can't be the parent directory of the SW path.
The text was updated successfully, but these errors were encountered:
We know the scope depends on the
sw.js
file's location, if the path ofsw.js
is '/sw-test/sw.js', then, the scope should be '/sw-test/'. So why do we need to define a scope attribute seperately?I found the the scope can't be the parent directory of the SW path.
The text was updated successfully, but these errors were encountered: