samples/service-worker
Jeffrey Posnick 025eb02a07 Merge pull request #124 from karolklp/gh-pages
2 more "mixed content" http/https errors fix
2015-05-08 12:40:42 -04:00
..
basic Update Service Worker/basic sample readme. 2015-02-09 10:56:03 +09:00
custom-offline-page Use `const` over `var` 2015-03-31 13:44:58 +02:00
fallback-response Force HTTPS across the SW samples. 2014-11-20 15:37:49 -05:00
immediate-control Tweaks 2015-04-01 13:21:56 -04:00
mock-responses A string can be used in a Response constructor now. 2015-02-12 12:16:54 -05:00
multiple-handlers Update link to multiple-handlers demo 2015-03-19 14:17:45 -04:00
offline-analytics Fix for mixed content 2015-04-29 10:01:08 +02:00
post-message Force HTTPS across the SW samples. 2014-11-20 15:37:49 -05:00
prefetch Fixes #96 2015-03-24 10:41:32 -04:00
read-through-caching Mixed content fix 2015-05-04 12:40:11 +02:00
registration Force HTTPS across the SW samples. 2014-11-20 15:37:49 -05:00
registration-events Replace usage of innerText with textContent 2015-02-10 07:48:41 -05:00
selective-caching Mixed content fix 2015-05-04 12:38:28 +02:00
window-caches Removed clients.claim, as it's not needed. 2015-04-09 16:09:28 -04:00
README.md Added a related samples section for push notifications 2015-05-05 11:49:34 -07:00
serviceworker-cache-polyfill.js Switched to the polyfilled methods. 2014-11-11 17:12:10 -05:00

README.md

Service Worker Recipes

  • Basic registration - a bare-bones sample that simply performs service worker registration, with placeholders for various event handlers.

  • Detailed registration - a sample that provides detailed information about the service worker registration and the state changes that a service worker undergoes.

  • Prefetching resources during installation - a sample demonstrating how to prefetch and cache a list of URLs during the service worker's installation, ensuring that they're available offline.

  • Selective caching - a sample of how a service worker can cache resources "on the fly", assuming the resources meet certain criteria (MIME type, domain, etc.).

  • Read-through caching - a sample of caching all resources that are requested "on the fly", unconditionally.

  • Offline Google Analytics - extends the read-through caching example to add in support for "replaying" failed Google Analytics pings, allowing pages to submit Google Analytics data associated with offline/cached page views.

  • Fallback responses - a sample illustrating how you can return alternative "fallback" content if an initial fetch request fails.

  • Mock responses - a sample illustrating how you can return content created on the fly in response to a page's requests.

  • Using postMessage - a sample illustrating the use of postMessage() to send commands from a controlled page to its service worker, giving the page control over the cache.

  • Multiple fetch handlers - a sample illustrating multiple fetch handlers, each of which intercepts a different type of request.

  • Custom offline page - a sample showing how to display a custom "Sorry, you're offline." error page when a network request fails.

  • Immediate control - a sample showing how to use skipWaiting() and clients.claim() to force a new service worker to take control of the page that just registered it.

  • Using window.caches - a sample showing how window.caches provides access to the Cache Storage API.

Related samples