小编use*_*107的帖子

检测Chrome中的Rich Notifications是否可用

我的Chrome扩展程序大量使用了webkitNotifications.我想切换到新的富通知(chrome.notifications),但这些通知尚未在所有平台上提供,而且仅在beta频道和更高版本中编写.如果富通知不可用,则应将webkitNotifications用作后备.因此,我正在寻找实现这个的最佳解决方案:

if(richNotificationsAvailable())
   chrome.notifications.create(...);
else
   webkitNotifications.createNotification(...).show();
Run Code Online (Sandbox Code Playgroud)

我尝试检查chrome.notifications.create未定义但是甚至为Chrome 27定义了禁用了丰富的通知chrome://flags.

google-chrome-extension rich-notifications

7
推荐指数
1
解决办法
2116
查看次数