Re: [w3c/ServiceWorker] Make Service Worker control only specific pages (#985)

@lmj0011 This is what I came up with

```
self.addEventListener("fetch", function(e) {
    if (e.clientId) {
        clients
        .get(e.clientId)
        .then((client) => {
            if(client.url == "page1.html" || client.url == "page2.html") {
                // respond to fetch request
            } else {
                // pass through
                e.respondWith(fetch(e.requestURL));
            }
        });
    } else {
        // pass through for navigation request
        e.respondWith(fetch(e.requestURL));
    }
});
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/985#issuecomment-253755588

Received on Friday, 14 October 2016 09:43:52 UTC