| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente |
| informatique:progressive_web_app_pwa [05/07/2025 13:55] – [Android Chrome] cyrille | informatique:progressive_web_app_pwa [12/07/2025 10:53] (Version actuelle) – ↷ Liens modifiés en raison d'un déplacement. 47.128.36.91 |
|---|
| * [[https://github.com/Minishlink/web-push-php-example|Minishlink/web-push-php-example]] a complete example with html+JS frontend and php backend using ''web-push-php'' | * [[https://github.com/Minishlink/web-push-php-example|Minishlink/web-push-php-example]] a complete example with html+JS frontend and php backend using ''web-push-php'' |
| * [[https://github.com/laravel-notification-channels/webpush|Web Push Notifications Channel for Laravel]] | * [[https://github.com/laravel-notification-channels/webpush|Web Push Notifications Channel for Laravel]] |
| | * https://framagit.org/Cyrille37/webpush-demo/-/tree/main |
| | |
| |
| ===== Online démos ===== | ===== Online démos ===== |
| |
| |
| mine: [[/app/le_saviez-vous_sur_wikipedia]] | mine: [[app:croustiwiki]] |
| |
| * App Directories | * App Directories |
| * librairie orientée mobile, à essayer absolument ;-) | * librairie orientée mobile, à essayer absolument ;-) |
| * [[https://github.com/Minishlink/pwa-qr-code-scanner|pwa-qr-code-scanner]] Lightweight progressive web app for scanning QR codes offline. Par l'auteur de [[https://github.com/web-push-libs/web-push-php|web-push-libs/web-push-php]] | * [[https://github.com/Minishlink/pwa-qr-code-scanner|pwa-qr-code-scanner]] Lightweight progressive web app for scanning QR codes offline. Par l'auteur de [[https://github.com/web-push-libs/web-push-php|web-push-libs/web-push-php]] |
| | * OsmApp https://github.com/zbycz/osmapp/ https://osmapp.org/ |
| | |
| |
| ===== Techno ===== | ===== Techno ===== |
| ==== Installation ==== | ==== Installation ==== |
| |
| Pour installer un PWA sans passer par une compilation et publication sur un magasin d'application: "installer sur l'écran d'accueil". | Pour installer un PWA sans passer par une compilation et publication sur un magasin d'application: "installer sur l'écran d'accueil" aka [[/glossaire/A2HS|A2HS]]. |
| |
| 😩 L'event ''beforeinstallprompt'' n'est pas implémenté par Safari on iOS ni Firefox for Android -> [[https://developer.mozilla.org/en-US/docs/Web/API/BeforeInstallPromptEvent#browser_compatibility|MDN browser_compatibility]] | 😩 L'event ''beforeinstallprompt'' n'est pas implémenté par Safari on iOS ni Firefox for Android -> [[https://developer.mozilla.org/en-US/docs/Web/API/BeforeInstallPromptEvent#browser_compatibility|MDN browser_compatibility]] |
| * [[https://web.dev/articles/customize-install#detect-launch-type|track 'display-mode']] | * [[https://web.dev/articles/customize-install#detect-launch-type|track 'display-mode']] |
| * [[https://medium.com/@dev-afzalansari/improving-the-install-experience-of-pwas-336d0684052d|Improve the Install Experience of PWAs]] | * [[https://medium.com/@dev-afzalansari/improving-the-install-experience-of-pwas-336d0684052d|Improve the Install Experience of PWAs]] |
| | |
| | Is your app installed? |
| | * [[https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getInstalledRelatedApps#browser_compatibility|Navigator: getInstalledRelatedApps() method]] |
| | * **Experimental** ! Seulement Chrome-android et Samsung-internet (2025-07) |
| | * https://web.dev/articles/get-installed-related-apps |
| | |
| |
| Tools & libraries : | Tools & libraries : |
| === iOS Safari === | === iOS Safari === |
| |
| | {{:informatique:pwa:install_ios_safari_01-half.jpg?direct&160|Install iOS Safari étape 1}} |
| | {{:informatique:pwa:install_ios_safari_02-half.jpg?direct&160|Install iOS Safari étape 2}} |
| | {{:informatique:pwa:install_ios_safari_03-half.jpg?direct&160|Install iOS Safari étape 3}} |
| | {{:informatique:pwa:install_ios_safari_04-half.jpg?direct&160|Install iOS Safari étape 4}} |
| | {{:informatique:pwa:install_ios_safari_05-half.jpg?direct&160|Install iOS Safari étape 5}} |
| |
| ==== Push API / WebPush ==== | ==== Push API / WebPush ==== |
| Voluntary Application Server Identification (VAPID) for Web Push [[rfc>8292]] [[rfc>9749]] | Voluntary Application Server Identification (VAPID) for Web Push [[rfc>8292]] [[rfc>9749]] |
| |
| * La **page de démo** https://simple-push-demo.vercel.app/ explique bien les différents éléments | * **page de démo** |
| | * https://simple-push-demo.vercel.app/ explique bien les différents éléments |
| | * https://tests.peter.sh/notification-generator/#actions=3 |
| * [[https://pqvst.com/2023/11/21/web-push-notifications/|Demystifying Web Push Notifications]] | * [[https://pqvst.com/2023/11/21/web-push-notifications/|Demystifying Web Push Notifications]] |
| * [[https://developer.apple.com/documentation/usernotifications/sending-web-push-notifications-in-web-apps-and-browsers|Sending web push notifications in web apps and browsers]] by Apple | |
| |
| * Mozilla / Firefox | * Mozilla / Firefox |
| * [[https://developer.apple.com/documentation/usernotifications/sending-web-push-notifications-in-web-apps-and-browsers|Sending web push notifications in web apps and browsers]] (developer.apple.com) | * [[https://developer.apple.com/documentation/usernotifications/sending-web-push-notifications-in-web-apps-and-browsers|Sending web push notifications in web apps and browsers]] (developer.apple.com) |
| * [[https://developer.apple.com/documentation/usernotifications/setting-up-a-remote-notification-server|Setting up a remote notification server]] | * [[https://developer.apple.com/documentation/usernotifications/setting-up-a-remote-notification-server|Setting up a remote notification server]] |
| | * Les notifs fonctionnent très bien (après A2HS), même mieux qu'avec Chrome ou Firefox car elles apparaissent sur l'écran vérouillé. Par contre Webkit (Safari) nettoie automatiquement toutes les données d'un site non visité depuis "//un certain temps//", dont le ServiceWorker qui se voit supprimé. Voir [[https://webkit.org/blog/16535/meet-declarative-web-push/|Meet Declarative Web Push]] qui rappelle le fonctionnement de l'ITP (Intelligent Tracking Prevention) de Webkit. |
| | |
| |
| Voir chapitre "[[#tools]]" pour la mise en œuvre. | Voir chapitre "[[#tools]]" pour la mise en œuvre. |
| |
| | === BadJwtToken === |
| | |
| | Apple: un ''POST'' d'envoi de message sur ''web.push.apple.com'' donne un ''403 Forbidden'' et ''reason:BadJwtToken'' avec le même code 😤 que pour Google et Mozilla qui eux fonctionnent. |
| | Après lecture attentive de [[https://developer.apple.com/documentation/usernotifications/sending-web-push-notifications-in-web-apps-and-browsers|Sending web push notifications in web apps and browsers]] : |
| | |
| | > **BadJwtToken** |
| | > The JSON web token (JWT) has one of following issues: The JWT is missing. The JWT is signed with the wrong private key. **The JWT subject claim isn’t a URL or mailto:**. The JWT audience claim isn’t the origin of the push service where you sent the request. The JWT expiration parameter is more than one day into the future. |
| | |
| | note: Apple seems to refuse url if it's TLD does not exists : it works with ''https://pouet.world'' but fail with ''https://code.devhost''. |
| | |
| | https://github.com/web-push-libs/web-push-php/issues/398 |
| | |
| | === stale/invalid subscriptions === |
| | |
| | * [[https://pushpad.xyz/blog/fcm-returns-404-for-stale-push-subscriptions|Google is removing the inactive and unreachable push subscriptions]] (2024-06) |
| |
| ==== WebAuthn ==== | ==== WebAuthn ==== |