iOS/iPadOS safari push api support

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 … Read more

Best practices for detecting offline state in a service worker

navigator.onLine and the related events can be useful when you want to update your UI to indicate that you’re offline and, for instance, only show content that exists in a cache. But I’d avoid writing service worker logic that relies on checking navigator.onLine. Instead, attempt to make a fetch() unconditionally, and if it fails, provide … Read more

How to get Add to Home Screen Pop up on Site Open in mobile browser

Official requirements are: Chrome automatically displays the banner when your app meets the following criteria: Has a web app manifest file with: a short_name (used on the home screen) a name (used in the banner) a 144×144 png icon (the icon declarations must include a mime type of image/png) a start_url that loads Has a … Read more

Open PWA when clicking on push notification handled by service-worker ng7 + android

Though the provided solutions work, it will be nice to have an approach which does not modify service worker code in node_modules or the generated code. The approach can be to create another script named custom-service-worker.js In this file, importScripts(‘./ngsw-worker.js’); (function () { ‘use strict’; self.addEventListener(‘notificationclick’, (event) => { console.log(“This is custom service worker notificationclick … Read more

Is it possible to track geolocation with a service worker while PWA is not open

The solution is at hand and has been for some years now as this POC clearly testifies. Unfortunately W3C have fought tooth and nail to prevent it from being made available 🙁 Why? I know not. The “cui bono” argument points to plug-in vendors such as Ionic whose whole raison d’etre appears to be background … Read more

Can service workers cache POST requests?

You can’t cache POST requests using the Cache API. See https://w3c.github.io/ServiceWorker/#cache-put (point 4). There’s a related discussion in the spec repository: https://github.com/slightlyoff/ServiceWorker/issues/693 An interesting solution is the one presented in the ServiceWorker Cookbook: https://serviceworke.rs/request-deferrer.html Basically, the solution serializes requests to IndexedDB.

What is this unknown Google-originating client that triggers JavaScript errors in our PWA?

This might be a headless Chrome (probably pre-release tests, in case you have it in the Play Store), which does not feature push permission; eg. with Pupeteer, one can only override permissions, but not really accept the permission prompt… and there generally is no desktop attached, where one could push notifications to. Just try and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)