开发者

Chrome extension Desktop notification

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 ?


If you have a reference of the notification object, you can use notification.cancel instead:

  setTimeout(function() { 
      notification.cancel(); 
  }, 5000);

References:

  • Chrome extension development: auto close the notification box
  • http://dev.chromium.org/developers/design-documents/desktop-notifications/api-specification


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);


for me this worked

setTimeout(function() {
    notification.close();
}, 2000);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜