问题
I am start working with PWA (Progressive web app). When I try to check service worker is supported or not in chrome browser.It always return false. Below code I used for the checking.
Note: I am using chrome Version 69.0.3497.81 (Official Build) (64-bit).
app.js
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js').then(function() {
console.log('service worker registered');
});
}
Need help to register service worker in chrome.
回答1:
This problem is cause due to I am running my application on http://192.168.1.11:8080 but when I switch domain to http://localhost:8080/. it's working fine.
Chrome requires service workers to be served over https, but allows an exception for localhost for development.
来源:https://stackoverflow.com/questions/52269746/service-worker-is-not-supported-in-chrome-69-0-3497-81