我正在使用createHTMLNotification
进行Chrome扩展。通知的html包含一个链接。我试图弄清楚的是如何在点击链接时关闭通知。我的代码如下关闭html5单击链接时的HTMLNotification
var notification = window.webkitNotifications.createHTMLNotification(
"notification.html"
);
notification.show();
notification.html页面上的代码填充数据。该页面包含jquery库。当我尝试做:
$('#title > a').click(function() {
notification.cancel();
}
这当然不起作用,因为通知未知此html页面上。我也尝试在创建通知的代码的第一部分执行notification.onshow
,但这并没有产生任何结果。