service-worker

Requests through service-worker are done twice

被刻印的时光 ゝ 提交于 2019-12-06 08:24:46
I've done a simple service-worker to defer requests that fail for my JS application (following this example ) and it works well. But I still have a problem when requests succeed: the requests are done twice. One time normaly and one time by the service-worker due to the fetch() call I guess. It's a real problem because when the client want to save datas, they are saved twice... Here is the code : const queue = new workbox.backgroundSync.Queue('deferredRequestsQueue'); const requestsToDefer = [ { urlPattern: /\/sf\/observation$/, method: 'POST' } ] function isRequestAllowedToBeDeferred (request

Progressive Web App: offline cache does not work on Android, it works on Chrome dev Tools

我是研究僧i 提交于 2019-12-06 08:20:45
问题 I have a simple PWA that works fine online. I have also tested the offline behaviour in Chrome Dev Tools, and the service worker is doing its job perfectly. But when I run the app from my Android phone, it doesn't work offline as the Cache Storage is no more present when offline. This is the service worker: var dataCacheName = 'myappData-v3n'; var cacheName = 'myapp-3n'; var filesToCache = [ '/meteosurf/', '/meteosurf/index.html', 'scripts/hammer.min.js', 'images/play_white.svg', 'images/stop

Service worker file not found in offline mode

血红的双手。 提交于 2019-12-06 07:56:43
My web app is like this: I have an Apache server running on port 80, with virtual hosts for my domain and different subdomains, including port 443 for SSL. I have a nodejs application running on port 5000. All traffic to my main domain is redirected using proxypass from apache to nodejs. NodeJs then loads Service Workers. Problem: ON first load of application in online mode it works properly.Shows Service worker registered over the complete domain message as expected. Even for some css,js and img it return response fromServiceWorker. But now when I open same page on offline mode service worker

(unknown): #2514: An unknown error occurred when fetching the script. [Service Workers]

浪尽此生 提交于 2019-12-06 07:19:48
Here's what's on console: (unknown): #2514: An unknown error occurred when fetching the script. [Service Workers] I am get the above error on my dev console when the service-worker has taken over or skipped waiting and I reload the page with the network turned off. The thing is I get plenty of fetch errors on the console because obviously none of the requests are passing through but there is just one error on SW dev console (Click image): What is it about? The error message itself isn't telling much about the issue, like the request it bailed out on or similar. I think you need to add your

What's the size limit of Cache Storage for Service Worker? [duplicate]

别说谁变了你拦得住时间么 提交于 2019-12-06 04:56:51
问题 This question already has answers here : What is the storage limit for a service worker? (5 answers) Closed 2 years ago . The size of Local Storage is limit to 5M, and is there any limit of Cache Storage when I used in Service Worker? 回答1: As of Aug 15 2016, Addy Osmani posted: How much can you store? In Chrome and Opera: Your storage is per origin (rather than per API). Both storage mechanisms will store data until the browser quota is reached. Apps can check how much quota they’re using

Redirection in progressive web app

别说谁变了你拦得住时间么 提交于 2019-12-06 04:05:44
问题 I am trying to redirect to a particular url in progressive web app on notification click but it does not redirect. Case 1: If the web app is not added to home screen then on notification click the browser window opens up and is redirected to the desired url. Case 2: If the web app is added to home screen then the landing page is the home page and not the desired url. self.addEventListener('notificationclick', function(event) { event.notification.close(); event.waitUntil( clients.matchAll({

Polymer serve and service worker

送分小仙女□ 提交于 2019-12-06 03:11:05
问题 I am trying to get started on debugging my Polymer application. I have hand crafted it by copying what I think the PolymerCLI Polymer init does. I am not sure what is loading service worker. The default one for development just does a console.info() call saying its been disabled for development. When I use Polymer serve to serve my application on localhost: 8080, I get the console.info message, despite there being nowhere where I actually load the file service-worker.js . Because the

How to deploy updates to service workers running on customers' sites?

纵然是瞬间 提交于 2019-12-06 03:03:04
Suppose I provide a push notification service used by different websites. This service requires a service worker to be installed on my customers' sites. I want the architecture to have a few properties: Completely static resources. The process of installing the service worker files and configuring the JS snippet, etc. only needs to be done once. The ability to update the service worker at any time. I want to be able to update the service worker at any time to fix bugs, deploy improvements, etc. Satisfying both of these constraints is difficult because the browser only installs a new version of

Sending push Notifications from Java Web Application

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 01:33:49
I have a Java web application which needs to send manual and automatic notifications to the user. This notification should go to the user's browser as well as the mobile devices (both iOS & Android). I found out there is no way to send notifications to mobile devices directly if there is no native application running on the mobile device. So my only option seems to be web push notifications. I went through a few articles and I found it very confusing. I don't know where to start. Can I send the notifications directly from Java Code? Or do I have to use FCM(Firebse)? If so can I call FCM

Chrome dev tools showing high cache storage utilisation

余生长醉 提交于 2019-12-06 01:22:47
I was analyzing the service workers and cache storage we have implemented in our website. Going through the process, I found out that the amount of cache storage used by the website is huge. The cumulative size of the files that I am adding to cache storage is not more than 5-6 MB . But in the chrome dev tools, it shows approximately 130 MB storage used. chrome - v 63 . OS - osx In incognito mode it shows usage as high as 100 MB which causes Quota Exceeded error . Even after clearing browsing data from chrome settings, and reloading the webpage (bandwidth speed - 1MBps) , just after 4-5