A browser logo is not a support test. Check the current environment for a secure context, service workers, the Push API, and the Notifications API; then apply platform-specific rules.
A technically supported browser can still be unable to subscribe because of private mode, device policy, blocked permission, missing installation steps, or operating-system settings.
Run capability checks before showing subscription controls
A useful interface tests the APIs it needs and hides or explains the subscription action when they are unavailable. Check window.isSecureContext, serviceWorker on navigator, PushManager on window, and Notification on window. This avoids promising support based on a user-agent string that can be incomplete, frozen, or affected by an embedded browser.
const pushCapable =
window.isSecureContext &&
"serviceWorker" in navigator &&
"PushManager" in window &&
"Notification" in window;
Capability detection answers whether the APIs are exposed. It does not answer whether the person has granted permission, whether a service worker registered successfully, or whether a valid subscription already exists. Test those states separately.
HTTPS is a production requirement
Service workers and the Push API are powerful features restricted to secure contexts. Serve the page, worker, manifest, icons, and subscription requests over HTTPS in production. Localhost is commonly treated as trustworthy for development, but a local success does not validate certificates, redirects, caching, content-security policy, or worker paths on the deployed hostname.
Test the exact production origin. Permission and service-worker registration belong to an origin, so www.example.com, app.example.com, and another scheme or port are not interchangeable environments.
Use a platform requirement matrix
| Environment | What to verify | Common false assumption |
|---|---|---|
| Desktop browser | Secure context, enabled notifications, successful worker registration, and a current subscription. | Browser support means the operating system will always display the alert. |
| Android browser | API support, site permission, browser notification settings, battery or background restrictions, and endpoint validity. | Every in-app or embedded browser exposes the same APIs as the full browser. |
| iPhone or iPad | The site follows the Home Screen Web Push requirements, permission follows direct interaction, and notification settings allow it. | A normal Safari tab can follow the same subscription flow as desktop Safari. |
| Managed device | Enterprise or school policy, firewall access to the browser’s push service, and operating-system restrictions. | The site can override a device administrator’s policy. |
Check permission without triggering it
Read Notification.permission before deciding which interface to show. A value of default means the browser has not recorded a final choice. granted allows notification display but does not prove a current push subscription exists. denied means site code should stop asking; changing the decision requires browser or operating-system settings.
Requesting permission should follow a direct, relevant user action. Browsers may restrict abusive or unsolicited prompts, and a quiet-permission interface can change how the request appears. Use the Web Push permission-prompt framework so a suppressed prompt is not mistaken for a successful subscription.
Verify the subscription, not only the permission
After the service-worker registration is ready, call registration.pushManager.getSubscription(). If it returns null, the browser has no current subscription for that registration even if notification permission is granted. If it returns a subscription, follow the subscription reconciliation process instead of assuming a record saved months ago is current.
A person may clear site data, remove a Home Screen web app, reset browser settings, or receive a new subscription endpoint. Your support check must tolerate all of those transitions.
Test the complete journey on real devices
- Open the deployed HTTPS origin and record the capability results.
- Register the intended worker and confirm its exact scope.
- Use the site’s opt-in action and record the permission state.
- Create or retrieve the subscription and verify the server stored it for the correct site.
- Send a short-lived test message and inspect the push-service response.
- Confirm the worker receives the event, displays a notification, and opens the expected destination.
- Repeat with the browser closed, the device locked, and relevant Focus or notification settings changed.
Use current documentation as the final compatibility check
The W3C Push API defines the browser interfaces and secure-context requirements. MDN documents Push API availability and usage. Apple’s Web Push for Web Apps on iOS and iPadOS explains Apple mobile prerequisites. Use those sources with real-device tests instead of publishing a permanent browser-version table that will go stale. For the complete system around those support checks, review the Web Push permission and delivery overview.
If support checks pass but the message does not appear, follow the step-by-step Web Push debugging sequence from permission through click handling.