docs(service-worker): mention that HTTPS is required, unless on `localhost` (#30847)
Fixes #30823 PR Close #30847
This commit is contained in:
parent
4ecff42e7f
commit
b74df20c2a
|
@ -59,6 +59,13 @@ With the server running, you can point your browser at http://localhost:8080/. Y
|
|||
|
||||
**Tip:** When testing Angular service workers, it's a good idea to use an incognito or private window in your browser to ensure the service worker doesn't end up reading from a previous leftover state, which can cause unexpected behavior.
|
||||
|
||||
<div class="alert is-helpful">
|
||||
|
||||
**Note:**
|
||||
If you are not using HTTPS, the service worker will only be registered when accessing the app on `localhost`.
|
||||
|
||||
</div>
|
||||
|
||||
### Simulating a network issue
|
||||
|
||||
To simulate a network issue, disable network interaction for your application. In Chrome:
|
||||
|
|
|
@ -33,6 +33,10 @@ Installing the Angular service worker is as simple as including an `NgModule`. I
|
|||
|
||||
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).
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
For more information about service workers in general, see [Service Workers: an Introduction](https://developers.google.com/web/fundamentals/primers/service-workers/).
|
||||
|
|
Loading…
Reference in New Issue