点击Google通知上的活动

Kis*_*jar 6 google-chrome google-chrome-extension

我正在为我的网站开发一个谷歌浏览器扩展程序.

我希望当用户点击谷歌浏览器的桌面通知时,我的网站会打开.

那么我该如何处理谷歌浏览器桌面通知点击事件?

Áko*_*ázy -3

基于此: http: //code.google.com/chrome/extensions/notifications.html 我这样解决:

我做了一个 notification.html 文件:

<html>
<head>
  <base target="_blank" />
</head>
<body>
  <a href="http://example.com">Open site</a>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我用以下代码打开通知:

var notification = webkitNotifications.createHTMLNotification(
    'notification.html'
);

notification.show();
Run Code Online (Sandbox Code Playgroud)

您可以使用 CSS 使其看起来像完整链接,而通知正文中没有文本。