Add to progressive enhancement section (#23741)

* Update index.md

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

* Update index.md
This commit is contained in:
Donald Maness
2019-01-23 16:43:05 -05:00
committed by Paul Gamble
parent 430408aad9
commit a1349084ba

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. 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
[![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") [![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")