service-worker

JavaScript Background Sync Stops Working if Page is Loaded/Refreshed while offline

北城以北 提交于 2021-02-08 17:01:55
问题 I'm currently learning how to use Background Sync as to allow users to PUT/POST changes while using a web app offline. I followed the instructions given by Jake Archibald in Introducing Background Sync , and everything worked great... as long as I register the Background Sync when the web app was loaded while being online . What I mean by that is: Steps that work: While online I open web app I turn offline mode on in the network tab I click some buttons that register a Background Sync. I turn

JavaScript Background Sync Stops Working if Page is Loaded/Refreshed while offline

帅比萌擦擦* 提交于 2021-02-08 17:01:42
问题 I'm currently learning how to use Background Sync as to allow users to PUT/POST changes while using a web app offline. I followed the instructions given by Jake Archibald in Introducing Background Sync , and everything worked great... as long as I register the Background Sync when the web app was loaded while being online . What I mean by that is: Steps that work: While online I open web app I turn offline mode on in the network tab I click some buttons that register a Background Sync. I turn

JavaScript Background Sync Stops Working if Page is Loaded/Refreshed while offline

≯℡__Kan透↙ 提交于 2021-02-08 17:01:23
问题 I'm currently learning how to use Background Sync as to allow users to PUT/POST changes while using a web app offline. I followed the instructions given by Jake Archibald in Introducing Background Sync , and everything worked great... as long as I register the Background Sync when the web app was loaded while being online . What I mean by that is: Steps that work: While online I open web app I turn offline mode on in the network tab I click some buttons that register a Background Sync. I turn

Serviceworker Bug event.respondWith

荒凉一梦 提交于 2021-02-08 13:14:37
问题 My serviceworker has the logic that when a fetch event happens,first it fetches an endpoint which contains some boolean value (not the event.request.url) and check the value , based on the value i am calling event.respondWith() for the current fetch event, where i am serving the response from cache.But i am getting the following error , Uncaught (in promise) DOMException: Failed to execute 'respondWith' on 'FetchEvent': The fetch event has already been responded to I checked here that this

Serviceworker Bug event.respondWith

那年仲夏 提交于 2021-02-08 13:14:05
问题 My serviceworker has the logic that when a fetch event happens,first it fetches an endpoint which contains some boolean value (not the event.request.url) and check the value , based on the value i am calling event.respondWith() for the current fetch event, where i am serving the response from cache.But i am getting the following error , Uncaught (in promise) DOMException: Failed to execute 'respondWith' on 'FetchEvent': The fetch event has already been responded to I checked here that this

Serviceworker Bug event.respondWith

雨燕双飞 提交于 2021-02-08 13:12:51
问题 My serviceworker has the logic that when a fetch event happens,first it fetches an endpoint which contains some boolean value (not the event.request.url) and check the value , based on the value i am calling event.respondWith() for the current fetch event, where i am serving the response from cache.But i am getting the following error , Uncaught (in promise) DOMException: Failed to execute 'respondWith' on 'FetchEvent': The fetch event has already been responded to I checked here that this

Firebase messaging.setBackgroundMessageHandler not receiving messages

白昼怎懂夜的黑 提交于 2021-02-08 08:23:44
问题 I am trying Firebase Cloud Messaging. It's awesome and all, but I am having the hardest time getting it to work for me. The problem I am facing is with the service worker, here is my firebase-messaging-sw.js : console.log('Service worker is loaded!'); self.addEventListener('install', function(event) { console.log('Service Worker is being installed.'); }); self.addEventListener('activate', function(event) { console.log('Service Worker is being activated.'); }); importScripts('https://www

Firebase messaging.setBackgroundMessageHandler not receiving messages

烈酒焚心 提交于 2021-02-08 08:22:20
问题 I am trying Firebase Cloud Messaging. It's awesome and all, but I am having the hardest time getting it to work for me. The problem I am facing is with the service worker, here is my firebase-messaging-sw.js : console.log('Service worker is loaded!'); self.addEventListener('install', function(event) { console.log('Service Worker is being installed.'); }); self.addEventListener('activate', function(event) { console.log('Service Worker is being activated.'); }); importScripts('https://www

How do I use service workers with an htaccess protected directory?

我与影子孤独终老i 提交于 2021-02-08 07:34:20
问题 I'm trying some basic service workers. The service worker itself will work normally the first time the service worker is registered. The problem I always get is once the person revisits the website in the future (e.g. the following day) and tries to access a .htaccess / .htpasswd protected directory. Instead of getting the dialog box, as normal, they go straight to a 401 error. This is how I am registering the service worker in script tags in the HTML. if ('serviceWorker' in navigator) {

Chromedriver Offline Network Conditions seems to not block Service Worker fetches

人走茶凉 提交于 2021-02-08 03:42:34
问题 I have a site with a Service Worker that caches some static resources on install. Some other resources are not cached, like data requests. So if you test the site using offline mode in Chrome, most of the page is properly displayed, but data is not there, and some errors appear in the console because of those failed requests. All right so far. But then I've created a test with Selenium and Chromedriver. I load that site, I visit the home page, Service Worker is properly installed, and then I