google-chromenotificationsauto-close

Chrome extension development: auto close the notification box


After doing something I run this code:

var notification = webkitNotifications.createNotification(
   'icon.png',  // icon url - can be relative
  'Done!',  // notification title
  'Just updated your list!'  // notification body text
   );
  notification.show();

which of course pops up a notification into the users screen.

It there anyway to time this notification so that it auto-closes in X amount of seconds?

Thanks! R


Solution

  • You can use notification.cancel();