parent
9e6c677135
commit
843881120a
|
@ -31,11 +31,34 @@ Installing the Angular service worker is as simple as including an `NgModule`. I
|
|||
|
||||
## Prerequisites
|
||||
|
||||
Your application must run in a web browser that supports service workers. Currently, service workers are supported in the latest versions of Chrome, Firefox, Edge, Safari, Opera, UC Browser (Android version) and Samsung Internet. Browsers like IE and Opera Mini do not provide the support. To learn more about other browsers that are service worker ready, see the [Can I Use](https://caniuse.com/#feat=serviceworkers) page and [MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API).
|
||||
To make use of all the features of Angular service worker, use the latest versions of Angular and the Angular CLI.
|
||||
|
||||
In addition, in order for service workers to be registered, the app must be accessed over HTTPS, not HTTP. Browsers will ignore service workers on pages that are served over an insecure connection. The reason is that service workers are quite powerful, so extra care needs to be taken to ensure the service worker script has not been tampered with.
|
||||
In order for service workers to be registered, the app must be accessed over HTTPS, not HTTP.
|
||||
Browsers ignore service workers on pages that are served over an insecure connection.
|
||||
The reason is that service workers are quite powerful, so extra care needs to be taken to ensure the service worker script has not been tampered with.
|
||||
|
||||
There is one exception to this rule: to make local development easier, browsers do _not_ require a secure connection when accessing an app on `localhost`.
|
||||
|
||||
### Browser support
|
||||
|
||||
To benefit from the Angular service worker, your app must run in a web browser that supports service workers in general.
|
||||
Currently, service workers are supported in the latest versions of Chrome, Firefox, Edge, Safari, Opera, UC Browser (Android version) and Samsung Internet.
|
||||
Browsers like IE and Opera Mini do not support service workers.
|
||||
|
||||
If the user is accessing your app via a browser that does not support service workers, the service worker is not registered and related behavior such as offline cache management and push notifications does not happen.
|
||||
More specifically:
|
||||
|
||||
* The browser does not download the service worker script and `ngsw.json` manifest file.
|
||||
* Active attempts to interact with the service worker, such as calling `SwUpdate.checkForUpdate()`, return rejected promises.
|
||||
* The observable events of related services, such as `SwUpdate.available`, are not triggered.
|
||||
|
||||
It is highly recommended that you ensure that your app works even without service worker support in the browser.
|
||||
Although an unsupported browser ignores service worker caching, it will still report errors if the app attempts to interact with the service worker.
|
||||
For example, calling `SwUpdate.checkForUpdate()` will return rejected promises.
|
||||
To avoid such an error, you can check whether the Angular service worker is enabled using `SwUpdate.isEnabled()`.
|
||||
|
||||
To learn more about other browsers that are service worker ready, see the [Can I Use](https://caniuse.com/#feat=serviceworkers) page and [MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API).
|
||||
|
||||
There is one exception to this rule: To make local development easier, browsers do _not_ require a secure connection when accessing an app on `localhost`.
|
||||
|
||||
## Related resources
|
||||
|
||||
|
@ -46,7 +69,6 @@ For more information about browser support, see the [browser support](https://de
|
|||
|
||||
The remainder of this Angular documentation specifically addresses the Angular implementation of service workers.
|
||||
|
||||
## More on Angular service workers
|
||||
## Next steps
|
||||
|
||||
You may also be interested in the following:
|
||||
* [Getting Started with service workers](guide/service-worker-getting-started).
|
||||
To begin using Angular service workers, see [Getting Started with service workers](guide/service-worker-getting-started).
|
||||
|
|
Loading…
Reference in New Issue