Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
111
rated 0 times [  115] [ 4]  / answers: 1 / hits: 46829  / 8 Years ago, thu, december 29, 2016, 12:00:00

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');
});
}
})();

More From » jquery

 Answers
119

Try using
http://127.0.0.1:8080 for hosting locally
instead of
http://192.168.29.53:8080


[#59526] Tuesday, December 27, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sonja

Total Points: 541
Total Questions: 113
Total Answers: 114

Location: Anguilla
Member since Sun, Jan 29, 2023
1 Year ago
sonja questions
Mon, Nov 30, 20, 00:00, 4 Years ago
Sun, Oct 11, 20, 00:00, 4 Years ago
Thu, May 21, 20, 00:00, 4 Years ago
Sun, Nov 10, 19, 00:00, 5 Years ago
Mon, Aug 26, 19, 00:00, 5 Years ago
;