我收到此通知,但仅显示约 5 秒。我希望它停留更长时间/或让它停留直到我点击它。
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if ((String(tab.title).search("Sniped:"))==0){
var notification = webkitNotifications.createNotification(
'face.png',
'Sniper',
tab.title
);
notification.show();
}
});
请提供有关如何执行此操作的建议?
最佳答案
我认为使用 webkitNotifications API 是不可能的。
您可以使用 chrome.experimental.notification 中的丰富通知 API。关于此 API 的信息还不是很多,但 Google 发布了一个包含几个示例的短视频,可以在此处查看:http://www.youtube.com/watch?v=g8fJWB2-pYk .
但请注意,如果您决定使用 chrome.experimental 中的 API,则无法在 Chrome 网上应用店中发布您的应用。有关实验性 API 的更多信息,请访问 http://developer.chrome.com/extensions/experimental.html
关于javascript - 如何让桌面通知保持不变?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15180454/