Javascript 如何保留桌面通知?
我收到了此通知,但仅显示约5秒钟。我想让它停留更长时间/或者让它停留到我点击它为止Javascript 如何保留桌面通知?,javascript,google-chrome,google-chrome-extension,Javascript,Google Chrome,Google Chrome Extension,我收到了此通知,但仅显示约5秒钟。我想让它停留更长时间/或者让它停留到我点击它为止 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { if ((String(tab.title).search("Sniped:"))==0){ var notification = webkitNotifications.createNotification( 'face.png',
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();
}
});
请给出一些建议?我认为使用WebKitNotificationsAPI是不可能的 您可以使用chrome.experional.Notification中的富通知API。关于这个API,他们还没有太多的信息,但是Google发布了一个包含两个示例的短视频,可以在这里看到:
但是请注意,如果您决定使用chrome.Experiative的API,则无法在chrome网络商店上发布应用程序。有关实验API的更多信息,请访问,也可以在调用函数“show()”之前执行此操作: 我想你知道如何使用它
notification.ondisplay = function(event) {
setTimeout(function() {
event.currentTarget.cancel();
}, 10000);
};