How Web Push Notifications Work, in Short

A web push notification is a message a website sends to your browser, which then shows it on your screen even when that site is closed. It works because you agreed, once, to receive messages from that site. The website's server sends the message to a push service run by your browser's maker, and that service delivers it to your device. The browser then wakes a small background script that the website installed earlier, and that script displays the alert.

Three parts do the work: the website's server, the browser's push service, and a background script called a service worker. The server writes the message, the push service carries it, and the service worker decides how it looks on your screen. The arrangement is the same whether the site is a news page, an online store, or a web app you added to your home screen.

Key Takeaways

  • Web push only works after you grant permission in your browser, so a site cannot send alerts to a device that has never agreed to them.
  • Each browser routes messages through its own push service, such as Google's service for Chrome and Mozilla's service for Firefox, which is why a notification can arrive even when the site is not open.
  • A website needs a service worker, a secure HTTPS connection, and a set of server keys before it can send anything, so the setup is mostly the site owner's job.
  • If alerts stop arriving, the cause is usually a revoked permission, a browser setting, a system focus mode, or an expired subscription, and each of these can be checked in your browser or device settings.

What a Website Needs Before It Can Send Alerts

Before any message goes out, the website has to be built for it. The site must be served over HTTPS, which is the encrypted connection shown by a padlock in the address bar. It must also register a service worker, a script the browser runs in the background separate from the open page. Without that script, the browser has nothing to wake when a message arrives.

The site owner also creates a pair of keys called VAPID keys. These identify the server to the push service so that the push service can confirm the messages really come from the website. The public key is shared with the browser during subscription, and the private key stays on the server. Libraries for common server languages can generate these keys, but the site owner must store the private key safely, because anyone holding it could send messages pretending to be the site.

Developers who build these features usually follow the Push API and Notifications API standards published by the W3C and the web platform documentation maintained by Mozilla and Google. Those documents describe exactly which browser features are required, and they change as browsers add or remove support.

Permission Prompts and Why Your Choice Matters

When a site wants to send you alerts, it first asks. The browser shows a permission prompt, usually near the top of the window, and the site cannot send a single message until you choose Allow. Many sites ask at the moment you arrive, which is a common reason people click Block without reading the request. Some sites wait until you have done something on the page before they ask, and a well-built site explains why it wants permission first.

Your choice is stored by the browser for that site. You can change it later in the browser's site settings, where you can turn notifications off for a single site, clear the setting so the site asks again, or block all sites from asking. Blocking a site does not delete your account with it, and it does not stop the site from working in other ways. It only stops the alerts.

Website owners cannot override a block. If a site keeps sending messages you did not agree to, the fix is in your browser settings rather than on the site. Reporting the sender to the site first is often faster, and most sites list an unsubscribe option in their settings page.

The Path a Message Takes From Server to Screen

When the website wants to send an alert, the server encrypts the content and sends it to the push service endpoint that was saved when you subscribed. The push service holds the message until your device is online and then delivers it. Each step is handled by a different party, which explains why a delay or failure can happen at any point along the way.

StepWho handles itWhat can go wrong
1. Site decides to send an alertWebsite's serverCode error, expired subscription, or no message scheduled
2. Message is encrypted and signedWebsite's server with VAPID keysMismatched or lost keys cause the push service to reject it
3. Message is held and deliveredBrowser's push serviceDevice offline for a long time, so the message may expire
4. Service worker wakes upYour browserScript missing or out of date, or browser has the site blocked
5. Notification appearsYour operating systemFocus mode, Do Not Disturb, or notification settings hide it

Messages are encrypted from the server to your browser, so the push service carries content it cannot read. Messages also have a lifetime. If your device stays offline past that limit, the push service drops the message, and the website does not necessarily learn that it was missed.

Web Push in Mobile Apps Compared With Browsers

Native mobile apps, the ones you install from an app store, usually use their platform's own push system. Apple devices use Apple Push Notification service, and Android apps commonly use Firebase Cloud Messaging. Those systems are built into the operating system, and the app's developer connects to them through an app SDK. The alert then looks and behaves like any other app notification in your phone settings.

Web push reaches phones through the browser instead. On iPhone and iPad, web push for sites added to the home screen became available in iOS 16.4 and later, and the site must be added to the home screen before it can ask for permission. On Android, Chrome and other browsers support web push directly. Whether a feature works depends on your operating system version and browser version, so the exact steps differ from one device to another.

For a reader, the practical difference is where to look when something goes wrong. Native app alerts are managed in the app's entry under your phone's notification settings. Web alerts are managed in the browser's site settings, and on some phones also in the home-screen app's settings. Checking the wrong place is one of the most common reasons people think an alert is broken when it is only switched off somewhere else.

What to Check When Alerts Stop Arriving

When alerts stop, start with the permission. Open the browser's site settings for that website and confirm notifications are set to Allow. If the site was blocked at any point, it stays blocked until you change it, even if the website still asks you to turn alerts on.

Next, check your device's focus or Do Not Disturb mode. These modes can hide every alert, including web push, and they are often turned on by a schedule you may have forgotten. Check your device's notification settings for the browser itself too, since turning off notifications for the browser stops web alerts from every site.

If permission and device settings look correct, the cause is often on the website's side. A subscription can expire, a service worker can be outdated, or the site may have changed its keys. Some sites offer a way to turn alerts off and on again in their settings, which creates a new subscription. If that does not work, contacting the site owner is the next step, because only they can see whether their messages are leaving their server.

Frequently Asked Questions

Do I need to have the website open to get a web push notification?

No. Once you have allowed notifications, the browser can receive messages through its push service and show them while the site is closed. The browser itself usually needs to be running in the background, or your device needs to be able to wake it. If you have closed the browser completely on some devices, alerts may wait until it opens again, depending on the system.

Can a website see if I ignored its notifications?

Sites can track some things about notifications, such as whether a message was delivered or clicked, if the site has built that tracking in. A site generally cannot see what else you do on your device because of a push permission alone. Your browser privacy settings and the site's own policy describe what is recorded.

Why does a site keep asking me to turn on notifications?

Many sites ask again after you have blocked them, because the browser lets them show the prompt again in some cases. Once you choose Block in your site settings, most browsers stop the prompt from appearing again for that site until you reset the setting. If the request keeps returning, check whether the site is using a custom message that sits on top of the browser prompt.

Is web push the same as an email or a text message?

No. Web push is delivered through your browser and only works when that browser and the site's service worker are set up. Email and text messages travel through different systems and reach you whether or not a browser is involved. Each type has its own settings, so turning one off does not change the others.