From a1349084ba00d7cacc1bbef07a997990ad59727d Mon Sep 17 00:00:00 2001 From: Donald Maness Date: Wed, 23 Jan 2019 16:43:05 -0500 Subject: [PATCH] Add to progressive enhancement section (#23741) * Update index.md Added additional information on progressive enhancement as it relates to Service Workers * Update index.md --- guide/english/progressive-web-apps/index.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/guide/english/progressive-web-apps/index.md b/guide/english/progressive-web-apps/index.md index 970924f5ad..35abe99c89 100644 --- a/guide/english/progressive-web-apps/index.md +++ b/guide/english/progressive-web-apps/index.md @@ -44,6 +44,16 @@ A great analogy from [Aaron Gustafson](http://alistapart.com/article/understandi This implies that depending on the browser, the experience can change. +Service Workers are progressive enhancement friendly, meaning that if a user's browser does not support Service +Workers, they will still be able to utilize the site, they just will not benefit from the additional functionality that PWAs offer. This can be acheived by wrapping the Service Worker code in a simple conditional statement that checks for Service Worker support within the browser. + +[Example](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/serviceWorker) +``` +if ('serviceWorker' in navigator) { + // Supported! +} +``` + ### Demo [![Demo on Progressive Web App](http://img.youtube.com/vi/esfi7ZLibmk/0.jpg)](https://www.youtube.com/watch?v=esfi7ZLibmk "Demo on Progressive Web App")