dio*_*cao 11 javascript html5 notifications google-chrome
我有一个页面,使用window.webkitNotifications通知用户有关服务器更新的信息.
它不是Google Chrome扩展程序.
我想在页面卸载前关闭所有页面通知.我正在努力做到:
var notifications = new Array();
// ...
var popup = window.webkitNotifications.createNotification(...);
// ...
notifications.push(popup);
// ...
function closeAll(){
for (notification in notifications) {
notifications[notification].cancel();
}
}
//...
$(window).unload(function() {
closeAll();
});
Run Code Online (Sandbox Code Playgroud)
但是当我重新加载页面时,通知没有关闭.我在Chromium项目中发现了这个问题:https://code.google.com/p/chromium/issues/detail? id = 40262
如何在不使用Window#onunload的情况下确保关闭页面通知?
| 归档时间: |
|
| 查看次数: |
1771 次 |
| 最近记录: |