What can you do if you receive that notifications? What does it mean? How can you fix it?
That notification is a message displayed automatically by Google Chrome when a website sends a push message, but then it doesn't show an actual notification to the user.
Since every push message activates the website in background, raising privacy concerns and consuming energy, Google Chrome allows push messages only if the website displays something to the user. If the website sends push messages, but it doesn't show a notification, Google wants to make sure that the user knows that the website is doing something... so it shows a default notification.
Fixing the problem as a user
If sometimes you receive that notification from a website, you should not worry about that. In any case you can also turn off the notifications for that website if you prefer.
Also make sure that your browser is updated to the latest version.
Finally you can also try to contact the website owner and report the bug.
Fixing the problem as a developer
If you are a website developer and your website shows that message you should try to fix it.
First of all you need to understand that silent push is currently not allowed. Indeed, when you subscribe a user to notifications, you call pushManager.subscribe(userVisibleOnly: true)
. The userVisibleOnly
flag means exactly that: you need to show something to the end user (e.g. a notification) every time that you send a push message.
Don't do this (silent push is not allowed):
self.addEventListener('push', function(event) {
// something in background, without notifications
});
Don't do this (incorrect):
self.addEventListener('push', function(event) {
var notification = event.data.json();
self.registration.showNotification(notification.title, notification.options);
});
Do this instead:
self.addEventListener('push', function(event) {
var notification = event.data.json();
event.waitUntil(
self.registration.showNotification(notification.title, notification.options)
);
});
Note the waitUntil
, which makes sure that the push
event returns only after the notification is displayed.
Otherwise Chrome will display the default notification:
This site has been updated in the background
Fixing the problem as a Pushpad customer
If you are a Pushpad customer (i.e. you send notifications from your website using Pushpad) you should never see that strange notification, because our SDK already manages everything properly and has been used in production for years.
In case of problems, make sure that you have installed the service worker properly (the Pushpad service worker, that you import in your service worker, includes the code that handles the push event and that displays the notifications).
You can also see the troubleshooting or contact our support in case of problems.
If only a few users experience problems, the most likely cause is that they are using old browser versions: in that case you should suggest to update their browser to the latest version.