Update UI when Service Worker installed successfully
问题 Looks like Service Worker runs in a worker context and has no access to the DOM. However, once Service Worker installed, I want my users to know that the app will now work offline. How can I do that? 回答1: When the Service Worker is in activated state , this is the perfect time to display the toast ' Content is cached for offline use '. Try something below code while registering your service worker. if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/service-worker.js').then