How Do I Make A Notification Stay Open Until The User Closes It?
Is there a setting that will allow me to keep a Notification open until a user clicks it? if (('Notification' in window)) { Notifi
Solution 1:
According to the docs there is a boolean requireInteraction
:
A Boolean indicating that on devices with sufficiently large screens, a notification should remain active until the user clicks or dismisses it. https://developer.mozilla.org/en-US/docs/Web/API/notification
new Notification('Hello', {
body : 'Hello',
requireInteraction: true
});
Tested in Chrome on MacOS.
Post a Comment for "How Do I Make A Notification Stay Open Until The User Closes It?"