Portfolio Supported AIs Solutions Tasks Email Archive Bring Your Own Code Integrations Pricing

Get Started

ChatGPT

ChatGPT

Start directly →

Ready
Claude

Claude

Directory Connector →

Ready
Mistral

Mistral

Directory Connector →

Ready

Dashboard Always available
← All articles

web push notifications

Web Push Notifications: How They Work and How to Add Them

Web push notifications explained for site owners: how they work, what browsers support, how to add them to a website or app, and how to fix them when they fail.

Web push notifications are short messages your website sends to a visitor’s browser, even when the visitor is not on your site. To add them, you need four things: a secure site, a service worker (a script the browser runs in the background), a visitor’s permission, and a server that sends the messages. This guide walks through each part in plain terms. It also shows where a full-stack setup, like WebsitePublisher, takes work off your plate: with WebsitePublisher, your AI assistant builds and publishes websites and apps through the WebsitePublisher connector, and the backend your notifications depend on is already part of the platform.

TL;DR

  • Web push needs three pieces: a permission prompt and subscription in the browser, a server that sends the message, and a service worker that displays it.
  • Apple documents web push for Home Screen web apps on iOS 16.4 or later, and for webpages in Safari 16 on macOS 13 or later.
  • Ask for permission after a click, not on page load, and show a notification for every push you send.
  • Most failures come from HTTPS, private browsing, blocked permissions, or device settings such as Focus and Do Not Disturb.
  • WebsitePublisher is a full-stack AI web platform for websites and apps, so the forms, data and email that support your messaging live in one place.

Table of Contents

What web push notifications are

A web push notification is a message that appears on a user’s screen, outside your page, after they agreed to receive it. It can show up on desktop or mobile, and it can arrive when your site is closed. Google’s web.dev overview describes web push as two technologies working together: push messaging, which delivers information from a server when the user is not using the site, and notifications, which display that information on the device.

Three things make this possible. Apple’s WebKit announcement of Web Push says it relies on the Push API, the Notifications API and Service Workers. In plain words:

  • Push API: lets the browser receive messages from a server.
  • Notifications API: lets the site show a message on the user’s device.
  • Service worker: a small script the browser keeps ready in the background. It wakes up when a message arrives.

The same WebKit post notes that a push subscription commits the site to showing every message it receives to the user. Web push is not a silent background channel. It is a promise to the visitor that what you send, they will see.

How a web push gets from your server to a screen

The flow has five steps:

  1. The visitor clicks a button on your site and allows notifications.
  2. The browser creates a subscription. It holds an endpoint (an address at the browser maker’s push service) and encryption keys.
  3. Your site sends that subscription to your server, which stores it.
  4. When you want to send a message, your server encrypts it and sends it to the endpoint.
  5. The push service routes the message to the browser. According to web.dev, that service is generally run by the browser vendor, and it can hold the message while the device is offline until it reconnects or the message expires. The browser then wakes the service worker, which shows the notification.

One detail matters for security. MDN’s Push API reference explains that a subscription endpoint works like a capability URL: anyone who knows it can send messages to that application. Store subscriptions on your server and treat them like private data.

This is why a push system is more than a script on a page. You need somewhere to keep subscriptions, something to trigger sends, and a way to connect those two. That is backend work, and it is the part non-technical founders often get stuck on.

Web push vs. app push

Web push is sent by a website to a browser and can appear even when the site is not open. Mobile push is sent by a mobile app and typically appears on the phone’s lock screen, as Klaviyo’s help documentation puts it.

For you, the practical difference is distribution. App push needs an app in an app store. Web push needs only a site and a visitor who opts in. That makes it a good fit for:

  • Order and shipping updates from a small store.
  • Booking confirmations and reminders.
  • New content alerts for a blog or portfolio.
  • Status changes in a client portal or web app.

It is a poor fit for anything the visitor did not ask to hear about. The opt-in is the whole contract.

Which browsers and devices support it

Support is wide on desktop and has been growing on mobile. The detail most people miss is iOS. Apple’s developer documentation on sending web push notifications states that web push works for web apps added to the Home Screen on iOS 16.4 or later, and for webpages in Safari 16 on macOS 13 or later. It uses the same cross-browser standards as other browsers.

So on iPhone and iPad, a visitor has to add your site to their Home Screen before you can ask for notification permission. If a large part of your audience is on iPhones, plan for that. Add a short line near your opt-in that explains how to install the site, and keep the push offer for people who have done so.

Browser support changes with each release. Before you build, check the compatibility table on the MDN Push API page for the current state.

Which browsers and devices support it

What your site needs before it can send pushes

Before any code, check this list:

  • A secure site. Push works only over HTTPS. MDN lists the Push API as available in secure contexts only.
  • An active service worker. MDN says a web app needs one before it can subscribe.
  • A subscription. It comes from the browser’s subscribe call and contains an endpoint and encryption keys.
  • A place to store subscriptions. This is your database or data store.
  • A sender. This is server code that encrypts and delivers the message to the push service.
  • A trigger. This is the event that causes a send: a new order, a new post, a form submission.

The last three are backend. If your site is only static pages, you have no place to keep subscriptions and nothing to trigger sends. That is why a full-stack setup matters for this feature.

How to add push notifications to a website

Here is the routine, step by step, with the point where each step usually goes wrong.

Step 1: Make sure the site is on HTTPS

Push will not work on plain HTTP. Confirm your live site loads with a padlock before you test anything else. Mixed setups, such as a staging address on one domain and the live site on another, are a common reason a test passes in one place and fails in the other, because a subscription belongs to one origin.

Step 2: Register a service worker

The service worker is the script that receives pushes and shows them. It handles two events: the push itself, and the click on the notification. Apple’s WWDC22 session on Web Push says the service worker handles both. The file’s location sets its scope, so place it at your site’s root if you want it to cover the whole site.

Before registering, check that the browser supports it. Google’s web.dev guide to push in all modern browsers recommends feature-detecting both the service worker and push manager support first.

Step 3: Build a clear opt-in

Add a button or banner that says what the visitor will receive and how often. Do not trigger the browser prompt on page load. Apple’s documentation says to ask for permission in response to a user gesture, such as a click, and to start the subscription right from that click handler. Subscribing requires a user gesture in Safari, as the WWDC22 session also states.

A two-step prompt works well in practice: your own button first, the browser prompt second. If the visitor says no to your button, you have not used up the one browser prompt you get.

Step 4: Save the subscription on your server

When permission is granted, send the subscription to your server. Per Apple’s documentation, you register the endpoint and encryption keys there. Link each subscription to what you know about the visitor, such as an account, an order or a list they chose. That link is what lets you send relevant messages instead of blasting everyone.

This step needs a data store. On WebsitePublisher, which is full-stack, the data layer is already built in next to hosting, auth, forms, email and uploads.

Step 5: Send a message from your server

Your server builds the message, encrypts it and sends it to the push service endpoint. Check the response for every send. A response that says the subscription is gone means you should delete it from your store. Otherwise your list fills up with dead addresses.

If you want to write the sending code in a language you prefer, our Bring Your Own Code page covers how to run it on the platform.

Step 6: Show a notification for every push

This rule is strict on Safari. Apple states that Safari does not support invisible push: display a visible notification as soon as the service worker receives a push, or Safari may revoke the site’s permission. Never use pushes to silently sync data. Every push you send needs something to show.

Step 7: Test on real devices

Send a test to yourself on desktop and on a phone. Test the click too: it should open the right page. Test in a normal window, not private browsing, because private modes do not support web push.

Wire pushes to events, not to guesses

The best notifications come from something that happened. A customer paid. A booking changed. A form arrived. Triggering a send from those events keeps messages timely and relevant.

On the platform side, our guide to setting up website webhooks shows how one event can fan out to more than one delivery. That pattern fits notifications well: the same order event can update your records, send a confirmation email and trigger a push. If the service you use for sending exposes its own API, our guide to connecting a custom API in six steps walks through discovery to verified access.

Permission and message habits that keep subscribers

A subscriber can switch you off in two clicks. These habits keep them:

  • Say what you will send. “Order updates and shipping alerts” beats “Stay in touch.”
  • Ask at the right moment. Offer the opt-in after the visitor has done something useful, such as placing an order or reading a second article.
  • Keep each message short. One idea, one link, a clear reason to tap.
  • Match the promise. If they signed up for shipping alerts, do not send promotions.
  • Cap the frequency. Decide a weekly maximum and keep to it.
  • Remove dead subscriptions. Clean your list when sends fail.

Email remains a good companion channel. A visitor who declines push can still leave an email address through a form, and you reach them there instead. Forms and email are part of the full-stack backend on WebsitePublisher, so both channels can live in the same project.

Why web push stops working, and how to check

When a test notification does not show, go through this list in order.

  1. HTTPS. Is the site served securely?
  2. Private browsing. Taboola’s help page on missing push notifications says private or incognito mode does not support web push. Switch to a normal window.
  3. Browser permission. Open the site settings in the browser and confirm notifications are set to allow for your domain.
  4. Operating system permission. The browser itself also needs permission to show notifications in the system settings.
  5. Focus or Do Not Disturb. The same Taboola page lists these, along with airplane mode and power-saving mode, as reasons a delivery can fail.
  6. Extensions. The page also names extensions that block pushes. Disable them for a test.
  7. Browser running. On desktop, check that the browser is open or allowed to run in the background.
  8. The service worker file. Open your browser’s developer tools, find the service worker panel, and confirm the script is active and loaded from the right origin.
  9. The subscription. Confirm it was saved on your server and that the send response is not reporting an error.

Work through the list before you change code. Most failures are settings, not bugs.

Where the AI web platform fits

Most guides on web push assume you have a developer, a server and time. You may have none of those. You may have an AI assistant and a business to run.

That is the situation we built for. With WebsitePublisher, the AI web platform, your AI assistant (ChatGPT, Claude, Gemini, Mistral, Cursor and others) builds and publishes websites and apps through the WebsitePublisher connector, which uses MCP, the Model Context Protocol that lets AI assistants control tools. The platform is full-stack: hosting, auth, payments, forms, email, uploads and data are already in place, and your assistant connects to 140+ tested integrations instead of writing untested glue code. Every change is live immediately.

For a notifications project, that gives you:

  • A live site with the secure hosting that push requires.
  • Data management for the records that tie subscribers to customers or lists.
  • Forms and email for visitors who prefer another channel.
  • Webhooks and custom API connections for triggering and delivering messages.
  • Project memory and task history that stay across sessions and assistants, so you can switch AI without losing context.

Tell your assistant exactly what you want. Our prompt engineering guide for websites and apps shows how to phrase requests so you get what you meant. To check which assistants work with the platform, see the supported AI platforms.

If your notifications are tied to recurring revenue, such as renewals and billing alerts, our guide to a subscription payments website covers the payment side.

What we think about web push

Web push rewards sites that treat it as a service to the visitor, not a megaphone. The technology is the easy part. The hard part is the data behind it: who subscribed, to what, and what event should trigger a message.

That is why we built WebsitePublisher as a full-stack AI web platform for websites and apps. When the backend is already there, your AI assistant can work on the opt-in, the data and the triggers in one project, and you can describe the result in your own words. You do not need to assemble hosting, a database, forms and email from separate tools first.

Our advice is simple: start with one useful notification tied to one real event, such as an order update. Get the opt-in wording right. Then add more only when subscribers keep wanting them.

Start building your site or app

If you want a site or app with a real backend behind it, WebsitePublisher is the AI web platform to start on. Connect your AI assistant, describe what you need, and it builds on a platform where hosting, auth, payments, forms, email, uploads and data are already built in. Plans are listed on our pricing page, and you can read more about how the AI web platform works.

Websitepublisher

You can then ask your assistant for the pieces your notifications need: an opt-in section, a subscriber data table and the forms and email that back it up.

FAQ

Do web push notifications work on iPhone?

Yes, with a condition. Apple documents web push for Home Screen web apps on iOS 16.4 or later. The visitor must add your site to their Home Screen first, then grant permission after a tap.

Do visitors need to be on my site to get a push?

No. Web push messages can arrive when the site is closed, because the browser’s service worker receives them in the background. The visitor must have opted in earlier, and their device must be online or reconnect before the message expires.

Is web push the same as email marketing?

No. Web push goes to a browser or installed web app and appears as a short alert on the screen. Email goes to an inbox and can carry longer content. Many sites use both: push for timely alerts, email for detail.

Why did my test notification never appear?

Start with the basics: HTTPS, a normal (non-private) window, and notification permission in both the browser and the operating system. Then check Focus or Do Not Disturb, extensions that block pushes, and whether your service worker is active.

Can I send a push without showing anything?

No, not on Safari. Apple says each received push must lead to a visible notification right away, or Safari may revoke the site’s permission. Plan every message so it has something worth showing.

Sources

Build your site the same way

Describe what you want. Your AI builds and publishes it — with the full stack behind it: data, auth, forms, payments, integrations and hosting.

See how it works →