When I try to add a service worker on my progressive web app page, why does the browser console show the following error?
ERROR "Uncaught (in promise) DOMException: Only secure origins are allowed
JS Code:
(function () {
'use strict';
// TODO add service worker code here
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('service-worker.js')
.then(function () {
console.log('Service Worker Registered');
});
}
})();
Try using http://127.0.0.1:8080 for hosting locally instead of http://192.168.29.53:8080