progressive-web-apps

Google Chrome Push Notifications not working if the browser is closed?

旧城冷巷雨未停 提交于 2019-11-30 13:43:02
问题 It is written here that the push notifications will work even if the browser is closed, but I tested it and it is not the case. I receive push-notifications only if the browser is open (doesnt matter if the particular webpage is open or not). I tested this on chrome for Desktop & chrome for Android (after updating to latest version). my question is :- For push notifications to work should the browser be open? Note:- I used this for testing. 回答1: According to Can I Use, Chrome and Firefox

Using service workers across multiple subdomains

五迷三道 提交于 2019-11-30 13:09:52
If my web app consists of more than one subdomain, does that mean I have to have multiple service workers, one for each subdomain? Or can I have one service worker that works across subdomains? Each subdomain is considered a different origin, so yes, you will need to register a service worker for each one. Each of these workers will have its own cache and scope. Each subdomain is considered a different origin and you must register a service worker for each origin but you can reuse the same source for the service worker by setting the Service-Worker-Allowed response header to the list of scopes

Google Chrome Push Notifications not working if the browser is closed?

牧云@^-^@ 提交于 2019-11-30 08:23:55
It is written here that the push notifications will work even if the browser is closed, but I tested it and it is not the case. I receive push-notifications only if the browser is open (doesnt matter if the particular webpage is open or not). I tested this on chrome for Desktop & chrome for Android (after updating to latest version). my question is :- For push notifications to work should the browser be open? Note:- I used this for testing. According to Can I Use , Chrome and Firefox desktop browsers require the browser to be running for receiving push notifications; mobile browsers typically

iOS 12 web push notifications

旧时模样 提交于 2019-11-30 08:05:45
Does the new iOS 12 safari support web push notification with service worker? In the last version of iOS there was service worker but there wasn't the pushManager object. iOS don't support the W3C Spec web push notifications yet. But there is a Safari specific API for web notifications. Refer to this answer on multiple options you have. https://stackoverflow.com/a/49803408/1057093 Update: Corrected the Answer in the above link to clarify proprietary solution is only for OS X - Safari and no solution for iOS Safari yet. Custom in app notification is the best we can do today for iOS Safari. I

PWA wont open in standalone mode on android

丶灬走出姿态 提交于 2019-11-30 07:36:12
问题 I am trying to implement Add To Home Screen on the latest Chrome & Android (7). I have specified "standalone" in the manifest file but the app only opens in the browser. I've gotten the desired behavior before on the same device, but can't seem to reproduce it. I see that someone had a similar issue in this question. I followed the suggested solution - validating PWA properties with Lighthouse - but even with a perfect 100 Lighthouse score, I am still unable to get the app to open in

Why is my 'add to home screen' Web App Install Banner not showing up in my web app

左心房为你撑大大i 提交于 2019-11-30 07:27:14
问题 I've created a service-worker and manifest.json file in order to display an 'add to home screen' Web App Install Banner for Chrome Browser Users. It is not working as intended. Here is my manifest.json file { "name": "MySite", "short_name": "Mysite", "start_url": "./?utm_source=homescreen", "icons": [{ "src": "assets/cacheable/images/shortcut/120x120.png", "sizes": "128x128", "type": "image/png" }, { "src": "assets/cacheable/images/shortcut/142x142.png", "sizes": "142x142", "type": "image/png

Best practices for detecting offline state in a service worker

六眼飞鱼酱① 提交于 2019-11-30 06:47:16
问题 I have a service worker that is supposed to cache an offline.html page that is displayed if the client has no network connection. However, it sometimes believes the navigator is offline even when it is not. That is, navigator.onLine === false . This means the user may get offline.html instead of the actual content even when online, which is obviously something I'd like to avoid. This is how I register the service worker in my main.js : // Install service worker for offline use and caching if

How can I test pushsubscriptionchange event-handling code?

限于喜欢 提交于 2019-11-30 05:17:39
问题 The pushsubscriptionchange event is fired by the browser when the push notification server wants the client to resubscribe. How can I manually trigger this event for testing? 回答1: Unfortunately it's not possible to do any end-to-end testing of this feature. The best you can do is fire the event via JS from the service worker: function triggerSubscriptionChange() { registration.pushManager.getSubscription().then(subscription => { if (subscription) { console.log("subscribed, subscription",

Handling File Uploads When Offline With Service Worker

不羁岁月 提交于 2019-11-30 04:57:55
问题 We have a web app (built using AngularJS) that we're gradually adding PWA 'features' too (service worker, launchable, notifications, etc). One of the features our web app has is the ability to complete a web form while offline. At the moment, we store the data in IndexedDB when offline, and simply encourage the user to push that data to the server once they're online ("This form is saved to your device. Now you're back online, you should save it to the cloud..."). We will do this

add to home screen not showing up PWA

£可爱£侵袭症+ 提交于 2019-11-30 02:40:36
问题 I've created a Progressive Web App. It's simple, just an index.html, a folder "images" with favicon etc, a sw.js et a styles.css My code from manifest.json { "lang" : "en", "name" : "Test", "short_name" : "Test", "icons" : [ { "src": "images/android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" }, { "src": "images/android-chrome-144x144.png", "sizes": "144x144", "type": "image/png" } ], "theme_color" : "#116b20", "background_color" : "#1a1a1a", "scope" : "1", "start_url" : "