To use all the features of Angular service workers, use the latest version of Angular and the Angular CLI.
The current version of Angular used by SAP E-Commerce Cloud Spartacus UI: ^13.3.0
To register a service worker, the application must be accessed over HTTPS rather than HTTP. Browsers ignore service workers on pages served over insecure connections. The reason is that Service Workers provide powerful HTTP request interception, so extra care needs to be taken to ensure that Service Worker scripts have not been tampered with.
There is one exception to this rule: to make local development more straightforward, browsers do not require a secure connection when accessing applications on localhost.
To benefit from Angular Service Workers, Angular applications must run in a Web browser that typically supports Service Workers. Service Workers are currently supported in the latest versions of Chrome, Firefox, Edge, Safari, Opera, UC Browser (for Android) and Samsung Internet. Browsers such as IE and Opera Mini do not support service workers.
If the user accesses the Angular application using a browser that does not support Service Workers, the Service Worker is not registered and related behaviors such as offline cache management and push notifications do not occur. Furthermore:
- Browser won't download service worker script and ngsw.json manifest file
- Active attempts to interact with the service worker, such as calling SwUpdate.checkForUpdate(), will return a rejected Promise
- Observable events for related services such as SwUpdate.available will not be fired
Angular officially strongly recommends that developers ensure that your application works even without service worker support in the browser. Although unsupported browsers ignore the service worker cache, the application will still report an error if it tries to interact with the service worker. For example, calling SwUpdate.checkForUpdate() returns a rejected Promise. To avoid observing such error messages in the Chrome Developer Tools console panel, check if the Angular Service Worker is enabled with SwUpdate.isEnabled.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。