You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below is the error which I received.
TypeError: Failed to register a ServiceWorker for scope ('http://localhost:9000/') with script ('http://localhost:9000/serviceWorker.js'): A bad HTTP response code (404) was received when fetching the script.
Below are the script added in index.html and serviceWorker.js is added at same location.
for now I kept serviceWorker.js empty
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('serviceWorker.js').then(function(registration) {
// Registration was successful
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}, function(err) {
// registration failed :(
console.log('ServiceWorker registration failed: ', err);
});
});
}
</script>
The text was updated successfully, but these errors were encountered:
chetanshinde118
changed the title
Server Worker is not working as expected in react typescript
Service Worker is not working as expected in react typescript
Mar 8, 2021
Below is the error which I received.
TypeError: Failed to register a ServiceWorker for scope ('http://localhost:9000/') with script ('http://localhost:9000/serviceWorker.js'): A bad HTTP response code (404) was received when fetching the script.
Below are the script added in index.html and serviceWorker.js is added at same location.
for now I kept serviceWorker.js empty
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('serviceWorker.js').then(function(registration) {
// Registration was successful
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}, function(err) {
// registration failed :(
console.log('ServiceWorker registration failed: ', err);
});
});
}
</script>
The text was updated successfully, but these errors were encountered: