angular-service-worker

Angular 5 Service worker not working / Doesn't cache background-image

百般思念 提交于 2019-12-13 13:33:34
问题 I'm having trouble getting my angular5 service worker to work. I have two main problems: The service worker doesn't cache assets images that are used as background-images After simulating a network disconnect the service worker initially pulls files from the cache (except the the aforementioned non cached files), but after a second refresh it runs into an error. Below is a more detailed report of my problem. You can follow along by cloning a repo I made to highlight this problem located here.

How do I access the local storage using service workers in angular?

廉价感情. 提交于 2019-12-11 12:52:10
问题 Okay now i am working on Angular 6 webApp and it is offline first. I am able to setup a fully functional service worker which can retrieve and store requests and response and what not. But, at one point , while registering a sync event, i needed refresh tokens which are stored in the local storage of my webApp. The problem is that service workers are not allowed to access local storage directly, means i don't have any access to the tokens residing in the local storage.How can i make use of

Angular PWA Offline Storage

有些话、适合烂在心里 提交于 2019-12-11 03:35:28
问题 I’m building a new web application which needs to work seamlessly even when there is no internet connection. I’ve selected Angular and am building a PWA as it comes with built-in functionality to make the application work offline. So far, I have the service worker working perfectly and driven by the manifest file, this very nicely caches the static content and I’ve set it to cache a bunch of API requests which I want to use whilst the application is offline. In addition to this, I’ve used

Angular Service Worker with POST request

你离开我真会死。 提交于 2019-12-10 21:22:52
问题 I use Angular 5.2.7 with Angular Service Worker 5.2.7. I want to cache webservices calls. So, I've got with this config in my ngsw-config.json, for dataGroups : "dataGroups": [{ "name": "tasks-users-api", "urls": ["/api", "/rest"], "cacheConfig": { "strategy": "freshness", "maxSize": 20000, "maxAge": "1h", "timeout": "5s" } }] I try to cache this two URLs : https://randomuser.me/api/?results=20 ---> It's OK https://test.moodlecloud.com/webservice/rest/server.php ---> It's KO The first one is

Angular Service Worker, caching api calls for offline app

白昼怎懂夜的黑 提交于 2019-12-10 17:11:34
问题 I'm trying to make the service worker in angular work with API requests. I'd like the app to work offline and I've the below config: { "name": "api", "urls": ["https://x.com/**"], "cacheConfig": { "strategy": "performance", "maxSize": 20, "maxAge": "365d", "timeout": "5s" } } Here is what the xhr tab looks like when I'm offline: and this is the content of the user request: As you can see the API calls for user don't resolve. This is what the response of user looks like when online: 回答1: Try

PWA Add To Home screen button in Chrome with Angular 4

大兔子大兔子 提交于 2019-12-10 15:27:56
问题 I have started working on PWA with Workbox3. And it is working out pretty amazing so far. I have added code to Add to Home Screen button so User can add it to there Mobile's Home screen. But the prompt box to add icon on Home screen showing only single time. Once I added that Icon to Home screen then after that it if I delete it and try same again then it shows nothing. I am checking in Desktop chrome from Chrome's DevTool->Application->Mainfest sectoin->Add to Home Screen . My Service worker

How API is getting cached effectively, Using Service worker in Angular 5 using Angular CLI

怎甘沉沦 提交于 2019-12-08 14:01:53
问题 Am new to service worker. I just want to know how the service worker handling the Data changes. For example, I have configured my data group in and set strategy to "performance" so that Service worker will always look first in Cache. That means any time the Registered URL in hit service worker will look in the cache first. Suppose the response has some changes ( data in database got changed ) will the response will update or still, it will take from the cache. I searched quite a bit in net I

Angular 6 PWA service worker not serving content offline

妖精的绣舞 提交于 2019-12-07 14:11:55
问题 I'm trying to set up a PWA with Angular 6 and having trouble to make the service worker serve content offline. I tried a lot of configurations and stuff for a couple of days now but with no success. The service worker seems to be registered and running lighthouse in audits tab in Chrome passes the pwa test. I'm using Contentful to serve texts/assets for this site. Service worker is fetching the content from dataGroups but it returns a 204 code when the service worker is doing the fetching. I

Check Service worker installation progress from component (angular)

假装没事ソ 提交于 2019-12-06 14:40:53
问题 I have updated my angular app into PWA, since I need to preload all of the assets on the first launch (application have a lots of images, which are used for UI). That's why I would like to show some kind of spinner/loading bar during service worker install event and hide it when it's done. So first question - is it possible to handle this event from the component? I have found this example and tried to add it inside first component, that loads on app launch, but didn't get any logs. So

Angular Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script

隐身守侯 提交于 2019-12-05 18:08:48
I am doing Push notifications in Angular PWA with Firebase and I am following a link to do so. https://medium.com/@tariqueejaz/progressive-web-app-push-notifications-making-the-web-app-more-native-in-nature-a167af22e004 I am using Angular 6 and have setup the code for everything. when I am trying to run it, then it is showing me a pop up . After clicking on Allow button, it is throwing an error on console: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script." code : "messaging/failed-serviceworker-registration" message : "Messaging: We are