diff --git a/functional-samples/cookbook.push/README.md b/functional-samples/cookbook.push/README.md index 11caee5c..05eaa200 100644 --- a/functional-samples/cookbook.push/README.md +++ b/functional-samples/cookbook.push/README.md @@ -4,12 +4,13 @@ This sample demonstrates using the [Push API](https://developer.mozilla.org/en-U ## Overview -By calling a method in the sample and using an external push server website we can simulate an extension receiving a push message where it is required to emit a notification and where it can bypass that requirement (`userVisibleOnly = false`). +By calling a method in the sample and using an external push server website we can simulate an extension receiving a push message where it is not required to emit a notification by setting (`userVisibleOnly = false`) on registration. ## Running this extension +Note: This sample requires Chrome 132+. Before Chrome 132, the same code works with the additional requirement of the `notification` extension permission. + 1. Clone this repository. -1. Ensure your operating system allows your browser to show desktop notification. For [MacOS](https://support.apple.com/guide/mac-help/change-notifications-settings-mh40583/mac) this, for Google Chrome, requires "Google Chrome" and "Google Chrome Helper (Alerts)" to be allowed. 1. Go to the [web push test server](https://web-push-codelab.glitch.me/) and copy the “Public Key” to the `APPLICATION_SERVER_PUBLIC_KEY` variable in background.js. 1. Load this directory in Chrome as an [unpacked extension](https://developer.chrome.com/docs/extensions/mv3/getstarted/development-basics/#load-unpacked). 1. Click “service worker (Inactive)” on the extension to load DevTools for background.js diff --git a/functional-samples/cookbook.push/background.js b/functional-samples/cookbook.push/background.js index 3617882a..c35a5077 100644 --- a/functional-samples/cookbook.push/background.js +++ b/functional-samples/cookbook.push/background.js @@ -56,7 +56,8 @@ self.addEventListener('push', function (event) { ); // Before `userVisibleOnly` could be passed as false we would have to show a - // notification at this point, but now we no longer have to. + // notification at this point (or if we didn't the browser would show a + // generic notification), but now we no longer have to. }); // Helper method for converting the server key to an array that is passed diff --git a/functional-samples/cookbook.push/manifest.json b/functional-samples/cookbook.push/manifest.json index 6b19fcea..31f80d78 100644 --- a/functional-samples/cookbook.push/manifest.json +++ b/functional-samples/cookbook.push/manifest.json @@ -1,9 +1,8 @@ { - "name": "Service worker with push notification", + "name": "Service worker with silent push message", "version": "1.0", "manifest_version": 3, "background": { "service_worker": "background.js" - }, - "permissions": ["notifications"] + } }