[ServiceWorker] Service Worker Scope (#782)

```
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