Add to progressive enhancement section (#23741)

* Update index.md

Added additional information on progressive enhancement as it relates to Service Workers

* Update index.md
pull/34940/head
Donald Maness 2019-01-23 16:43:05 -05:00 committed by Paul Gamble
parent 430408aad9
commit a1349084ba
1 changed files with 10 additions and 0 deletions

View File

@ -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")