progressive-web-apps

Progressive web app Uncaught (in promise) TypeError: Failed to fetch

别等时光非礼了梦想. 提交于 2019-12-04 09:18:08
问题 I started learning PWA (Progressive Web App) and I have problem, console "throws" error Uncaught (in promise) TypeError: Failed to fetch. Anyone know what could be the cause? let CACHE = 'cache'; self.addEventListener('install', function(evt) { console.log('The service worker is being installed.'); evt.waitUntil(precache()); }); self.addEventListener('fetch', function(evt) { console.log('The service worker is serving the asset.'); evt.respondWith(fromCache(evt.request)); }); function precache

Redirection in progressive web app

泪湿孤枕 提交于 2019-12-04 09:06:38
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({ type: "window" }).then(function(clientList) { console.log(clientList); for (var i = 0; i < clientList

How do I sync data with remote database in case of offline-first applications?

那年仲夏 提交于 2019-12-04 08:38:51
问题 I am building a "TODO" application which uses Service Workers to cache the request's responses and in case a user is offline, the cached data is displayed to the user. The Server exposes an REST-ful endpoint which has POST, PUT, DELETE and GET endpoints exposed for the resources. Considering that when the user is offline and submitting a TODO item, I save that to local IndexedDB, but I can't send this POST request for the server since there is no network connection. The same is true for the

PWA Application is initialized every time after going background in iOS

大憨熊 提交于 2019-12-04 08:06:14
问题 I'm now testing PWA application. In Android, it works well. Even after going background, PWA app keep condition and user can continue their experience. But in iOS, every time after PWA app goes background, it is initialized and every condition is crushed like it is reloaded. User experience is terminated. How can I prevent this in iOS? 回答1: Update : With the latest version of iOS(I've tested with 12.4), PWA state is preserved. Thanks to Leox and Roshil on confirming the same with another

Open external links in webview as default in IOS PWA

好久不见. 提交于 2019-12-04 06:02:57
I'm testing Progressive Web App in IOS 11.3. My pwa has a Facebook social login button that, when clicked, points to an external link (different windows.location). The problem is that the pwa opens safari app to show external links instead of using a webview within the pwa. So, when the login is done, you will not be redirected to the pwa, but remains in safari. I tried following examples like this one: https://gist.github.com/kylebarrow/1042026 but seems not working How can I force the pwa to open external links in a webview? Thanks in advance This problem is solved in IOS 11.4 UPDATE

Requirements to make PWA in a WebAPK format

烈酒焚心 提交于 2019-12-04 02:50:11
I am working on my website. I managed to get basic PWA functionality using the web page manifest file. Not long ago, Google released deeply integrated PWAs, allowing users to make a WebAPK when they added the page into the home screen. I want my page to also have that kind of feature, but it is never been clear what I should do to get that functionality.. Do I need to add something extra aside from the manifest file, sw.js and various meta tags? This is not something we can control. Chrome was/is experimenting with "improved A2HS" as they called it (A2HS stands for "add to homescreen") and a

Add more service-worker functionality with create-react-app

吃可爱长大的小学妹 提交于 2019-12-04 02:26:36
So create-react-app includes service worker functionality by default , which is lovely - all my static assets get cached for offline use out of the box. Cool, but now I want to take things a bit further and use indexedDB to cache some dynamic content. Problem is, there's no service-worker.js file to modify. It gets generated during the build process. Is there a way to add additional logic without ejecting create-react-app or redoing all the nice static caching stuff? As you've observed, create-react-app 's config is locked down, and the service worker logic is entirely defined in the config.

An unknown error occurred when fetching the script (Service Worker)

人走茶凉 提交于 2019-12-03 23:57:18
When going offline, I get the following error by my service worker: (unknown) #3016 An unknown error occurred when fetching the script my service worker looks like this: var version = 'v1' this.addEventListener('install', function(event){ event.waitUntil( caches.open(version).then(cache => { return cache.addAll([ 'https://fonts.googleapis.com/icon?family=Material+Icons', 'https://fonts.googleapis.com/css?family=Open+Sans:400,600,300', './index.html' ]) }) ) }) this.addEventListener('fetch', function(event) { event.respondWith( caches.match(event.request).then(function(resp) { // if it's not in

Uncaught (in promise) TypeError: Request failed pwa error

末鹿安然 提交于 2019-12-03 21:58:56
I am trying to build a Progressive Web App (PWA). The service worker shows registered, PWA audit shows everything good, but the console shows this error: TypeError: Request failed pwa error I am unable to cache the files. I tried all possible answers on Stack Overflow and it's the same //self.addEventListener('fetch', function(event) {}); var dataCacheName = 'myappData-v3n'; var cacheName = 'myapp-3n'; var filesToCache = [ 'images/logo.png', 'js/jquery.min.js', 'js/popper.min.js', 'js/bootstrap.min.js', 'js/main.js', 'css/bootstrap.min.css', 'css/fontawesome-all.min.css', 'css/style.css', 'css

Why does upload image via camera work on mobile-safari but not as iOS PWA?

三世轮回 提交于 2019-12-03 21:15:33
I have a webpage with PWA capabilities. On iOS safari I do get the usual OS dialog asking me if I want to take a photo or upload a picture from the photo library: After "installing" it as an PWA via the menu "Add to Homescreen" button and starting it via homescreen, I still get the same options, "choose from library" still works, but when choosing "take a photo", the iOS camera app opens, as expected, but stays completely black. html: <head> <meta charset="utf-8"> <title>dingsda user interface 2</title> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="mobile-web-app