progressive-web-apps

PWA: How to programmatically trigger : “Add to homescreen”? on iOS Safari

随声附和 提交于 2019-12-03 09:43:35
I released a server rendered progressive web app recently and everything works great so far. However, Android using chrome shows a banner to download the app which is awesome, but it doesn't on iOS. Using Safari, a user needs a few clicks to get to the "Add to homescreen" feature which is bad. So here I am, I'm satisfied with my PWA, but I would really love to be able to tell the user myself that this app can be added to homescreen. As far as I can remember, I saw https://marvelapp.com/ doing it to add a prototype to the homescreen. iOS - Safari currently don't support Web app install banner,

Progressive Web App “does not work offline” error

安稳与你 提交于 2019-12-03 08:37:43
I have written a progressive web app, following all available guides and examples, but for some reason when I click the Add to homescreen button, I keep getting this mysterious error: Site cannot be installed: does not work offline The major difference between my PWA and the examples, is that mine is running purely in a non-root path of the domain, so I have had to add extra paths to the configs in various places so the app is restricted to the non-root folder. The Google Lighthouse site doesn't help much either, giving a very similar message. Can anyone suggest what this error might be caused

What's the right way to implement offline fallback with workbox

放肆的年华 提交于 2019-12-03 08:37:32
I am implementing PWA into my project, I have setted up the serviceworker.js, and I am using workbox.js for cache routing and strategies. 1- I add the offline page to cache on install event, when a user first visit the site: /** * Add on install */ self.addEventListener('install', (event) => { const urls = ['/offline/']; const cacheName = workbox.core.cacheNames.runtime; event.waitUntil(caches.open(cacheName).then((cache) => cache.addAll(urls))) }); 2- Catch & cache pages with a specific regex, like these: https://website.com/posts/the-first-post https://website.com/posts/ https://website.com

Any way yet to auto-update (or just clear the cache on) a PWA on iOS?

☆樱花仙子☆ 提交于 2019-12-03 07:50:33
问题 I have been struggling on iOS with something that works easily on Android: Getting my PWA to auto-update when there is a new version. I am not at all sure this is even possible on iOS. I have used vue.js and Quasar to build my app, and everything works out of the box on Android. Here is the (ugly, terrible) way things stand currently on the iOS version: I can check my own server for the version and compare it against the current one stored in my app (in indexedDB) and throw up a notice that

WKWebView analog of service worker

為{幸葍}努か 提交于 2019-12-03 07:47:25
I'm trying to implement part of app with PWA approach, that works fine on Android , but not for iOS . We need to have offline content availability option to update content dynamically (like special offers or so). With service worker we show prompt to update web content. As were mentioned here service workers are not supported within WKWebView (or UIWebView ). So is there analog or alternative solution like smart cache control? Seems like it is possible to store some web content from app and be able to update it if something changes. May there is already a framework/library/approach for that

How can I initiate a PWA (progressive webapp) open from a click on a push notification?

懵懂的女人 提交于 2019-12-03 07:42:29
Following this example , I see how PWA can open urls but how can I use push notification to launch the app itself? Not in the browser but the full screen version PWA. Matt Gaunt This is controlled by the browser. In addition when deciding to open a window it might be worth checking if the desired target URL is already open in a different tab/window so you can focus or open it, depending on the situation. Check this book here for some code samples . For example in Chrome, if a user adds a web app to their homescreen with "standalone" in their manifest when ever the user clicks the web apps icon

Can I have multiple service workers both intercept the same fetch request?

自古美人都是妖i 提交于 2019-12-03 05:43:51
问题 I'm writing a library which I will provide for 3rd parties to run a service worker on their site. It needs to intercept all network requests but I want to allow them to build their own service worker if they like. Can I have both service workers intercept the same fetches and provide some kind of priority/ordering between them? Alternatively is there some other pattern I should be using? Thanks 回答1: No, you can not. Only one service worker per scope is allowed to be registered so the latest

Can a progressive web app (PWA) run a background service on a mobile device to get data from hardware (accelerometer, gps…)?

老子叫甜甜 提交于 2019-12-03 05:34:00
I see we can check the capabilities of a mobile browser using https://whatwebcando.today/ , but can the hardware APIs be queried when not running on foreground? I mean... With PWA am I able to build an app that gets hardware info while running in background, just like Octo U, for Android, and posts that info to a web server? The modern method of running code "in the background" is by using a service worker , either via its push event handler (triggered via an incoming push message), or via its sync event handler (triggered by an automatic replay of a task that previously failed). It's not

PWA icons are not used in iOS 11.3

萝らか妹 提交于 2019-12-03 05:31:08
Now I'm testing PWA on iOS 11.3 and I use the manifest.json file below: { "name": "Maplat PWA Sample", "short_name": "Maplat PWA", "background_color": "#fc980c", "icons": [{ "src": "/Maplat/pwa/icon-96.png", "sizes": "96x96", "type": "image/png" },{ "src": "/Maplat/pwa/icon-144.png", "sizes": "144x144", "type": "image/png" },{ "src": "/Maplat/pwa/icon-192.png", "sizes": "192x192", "type": "image/png" },{ "src": "/Maplat/pwa/icon-256.png", "sizes": "256x256", "type": "image/png" }], "start_url": "/Maplat/debug.html?overlay=true", "display": "standalone" } This works well except icon setting. In

PWA - beforeinstallprompt not called

徘徊边缘 提交于 2019-12-03 05:23:07
Hello I'm trying to install a custom PWA "Add to Homescreen". The ServiceWorkerRegistration is successful. But the function beforeinstallpromp is not calling after register. <script type="text/javascript"> function request_debug(paramdata){ document.getElementById('output').innerHTML += '<BR>'+ paramdata; } window.addEventListener('load', function() { document.getElementById('output').style.display = "block"; if('serviceWorker' in navigator) { navigator.serviceWorker.register('sw.js').then(function(registration) { console.log('Service worker registrado com sucesso:', registration); request