service-worker.js:1 GET http://localhost:8080/service-worker.js net::ERR_FILE_EXISTS
यह वह त्रुटि है जब मैं सेवा कार्यकर्ता पंजीकृत करने के बाद हर बार प्राप्त करता हूं। मैंने यह सुनिश्चित कर लिया है कि सेवा-कार्यकर्ता.जेएस फ़ाइल रूट निर्देशिका में मौजूद है। इसके अलावा सेवा कर्मचारी पंजीकृत है और ठीक काम कर रहा है। लेकिन मुझे अभी भी यह त्रुटि मिल रही है। मैं भी स्थानीयहोस्ट पर काम कर रहा हूं।सेवा कार्यकर्ता नेट :: ERR_FILE_EXISTS त्रुटि फेंक रहा है?
console.log("SW startup");
var CACHE_NAME = "my_cache";
var urlsToCache = [
'./',
'./css/style.css',
'./js/script.js'
];
self.addEventListener('install', function(event) {
// Perform install steps
event.waitUntil(
caches.open(CACHE_NAME)
.then(function(cache) {
console.log('Opened cache');
return cache.addAll(urlsToCache);
})
);
});
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.open(CACHE_NAME).then(function(cache) {
return cache.match(event.request).then(function (response) {
return response || fetch(event.request.clone()).then(function(response) {
console.dir(response);
console.log('hi');
cache.put(event.request.clone(), response.clone());
return response;
});
});
})
);
});
script.js फ़ाइल:
if (navigator.serviceWorker) {
console.log("ServiceWorkers are supported");
navigator.serviceWorker.register('service-worker.js')
.then(function(reg) {
console.log("ServiceWorker registered ◕‿◕");
console.dir(reg);
})
.catch(function(error) {
console.log("Failed to register ServiceWorker ಠ_ಠ");
console.dir(error);
});
}
क्या आप कह रहे हैं कि मैंने यह त्रुटि मेरी साइट के उत्पादन कोड में आने दी है ?? /// ..... यह भी अन्य वेबसाइट कंसोल में अन्य त्रुटि क्यों नहीं आती है (अन्य वेबसाइटें जिन्होंने सेवा कार्यकर्ता को कार्यान्वित किया है ???) –
@amansatija फेसबुक कंसोल को खोलने पर कुछ सेकंड के बाद त्रुटि दिखाता है। –
या मैंने इसे देखा, अब एक दिन यह हर साइट पर आता है जिसने सेवा कार्यकर्ता को लागू किया है ...> !!! यहां तक कि चिंतित भी –