From 341d5ac44003aaed63efce90769d981a273dd6be Mon Sep 17 00:00:00 2001 From: Andrey Reinwald Date: Sun, 5 Nov 2023 09:27:29 +0100 Subject: [PATCH] Update README.md --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index 026809e..3b4591b 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,44 @@ _WebPush - is browser technology that allows site developer send notifications f --- # More info +- [Basic WebPush subscription code](#Basic-WebPush-subscription-code) - [Installing PWA](#Installing-PWA) - [Generating VAPID key](#Generating-VAPID-key) - [Subscription and saving token](#Subscription-and-saving-token) - [Service worker](#Service-worker) - [Sending push message](#Sending-push-message) +## Basic WebPush subscription code +Example of basic subscription code, that works in Google Chrome and Firefox.
+```html + + + + + + + +``` +You can run it locally by creating index.html and serviceworker.js files with a simple html server: +```shell +npx http-server +``` + ## Installing PWA WebPush is Progressive Web App(PWA) feature so you need to ask user to enable PWA mode first.
On iOs devices it can be made with button **"Add to Home Screen"** in browser.