Solved:
First thing is service worker only works in secure mode either in https or localhost.
It doesnot work in local resources like file:// or http.
and second issue was during registration.
navigator.serviceWorkerContainer
.register('service-worker.js')
.then(function(reg){
More Related Contents:
- What is JavaScript’s highest integer value that a number can go to without losing precision?
- JavaScript, browsers, window close – send an AJAX request or run a script on window closing
- How to detect my browser version and operating system using JavaScript?
- Is it possible to sandbox JavaScript running in the browser?
- How can I close a browser window without receiving the “Do you want to close this window” prompt?
- How to copy text to the client’s clipboard using jQuery? [duplicate]
- Changing the browser zoom level
- How to force reloading a page when using browser back button?
- Is JSON Hijacking still an issue in modern browsers?
- Options for testing service workers via HTTP
- Why should y.innerHTML = x.innerHTML; be avoided?
- Prevent automatic browser scroll on refresh
- Is there any practical reason to use quoted strings for JSON keys?
- Any way to identify browser tab in JavaScript?
- How do I stop the Back and Refresh buttons from resubmitting my form?
- Detect if browser is running on an Android or iOS device
- Using JavaScript to edit CSS gradient
- Best way to check for IE less than 9 in JavaScript without library
- JS – Mobile – Open Safari from any browser [closed]
- Setting minimum size limit for a window minimization of browser?
- Alternative version for Object.values()
- Can dynamically loaded JavaScript be unloaded?
- How can I know whether refresh button or browser back button is clicked in Firefox? [duplicate]
- Service worker is caching files but fetch event is never fired
- Equivalent of Firefox’s “error console” in other browsers
- Breaking JavaScript execution when cookie is set
- How to make browser full screen using F11 key event through JavaScript [duplicate]
- How to focus an input field on Android browser through javascript or jquery
- HTML5 Video autoplay with sound unmuted
- How do I dynamically adjust css stylesheet based on browser width?