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 ?
Asked
Active
Viewed 3,229 times
10
-
[Chrome supports desktop notifications natively](http://stackoverflow.com/questions/2271156/chrome-desktop-notification-example). – Dan Dascalescu Feb 11 '14 at 05:46
3 Answers
12
If you have a reference of the notification object, you can use notification.cancel instead:
setTimeout(function() {
notification.cancel();
}, 5000);
References:
Community
- 1
- 1
newtonapple
- 4,083
- 3
- 31
- 30
9
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);
serg
- 106,723
- 76
- 306
- 327