Notification.requestPermission(function(permission){ // переменная permission содержит результат запроса console.log('Результат запроса прав:', permission); //default — запрос на получение прав не отправлялся //granted — пользователь разрешил показывать уведомления //denied — пользователь запретил показывать уведомления }); var notification = new Notification('Тема уведомления', { body: 'Тело уведомления', dir: 'auto', icon: 'icon.jpg', tag: "333" } ); 

Can I send notifications to the user if his site is closed? And How?

  • It is doubtful. Is that the user installs your browser plugin. In general, I think it would be more correct to use something ready that many users already have, for example Telegram - Ninazu

1 answer 1

Notification - works only if the site is open.

Look in the direction of Push API - Sample Information

  • If I understand correctly, then you need an API key from Google, so that everything would work? The key is paid as far as I know. - Vladimir