- From: Fred Xue <notifications@github.com>
- Date: Thu, 19 Nov 2015 00:26:03 -0800
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
Received on Thursday, 19 November 2015 08:26:34 UTC
``` 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. --- Reply to this email directly or view it on GitHub: https://github.com/slightlyoff/ServiceWorker/issues/782
Received on Thursday, 19 November 2015 08:26:34 UTC