Reputation: 5528
I am working on a chrome extension for desktop notification.Is there any way by which I can close the desktop notification after a specified time ?
Upvotes: 10
Views: 3331
Reputation: 3621
for me this worked
setTimeout(function() {
notification.close();
}, 2000);
Upvotes: 1
Reputation: 4133
If you have a reference of the notification object, you can use notification.cancel instead:
setTimeout(function() {
notification.cancel();
}, 5000);
References:
Upvotes: 12
Reputation: 111365
You can close it by running window.close()
from notification's javascript (assuming your notification is a separated HTML file). So something like this:
setTimeout(function() {
window.close();
}, 5000);
Upvotes: 9