Service worker is not supported in chrome (69.0.3497.81)

感情迁移 提交于 2020-01-23 07:57:39

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!