Prevent chrome.notifications API from hiding my notification after a few seconds

Notification now has (since Chrome 50) a requireInteraction property to force the notification to stay on screen:

var notification = new Notification("TITLE", {
          icon: 'assets/res/icon.png',
          body: "MESSAGE",
          requireInteraction: true     
});

In onclick you have to close the notification:

notification.onclick = function()
{
    this.close();
}

Leave a Comment