1

我将脚本(background.js)设置为背景manifest.json

并将代码写入 background.js:

var source = new EventSource('http://localhost:8086/test/');
source.addEventListener('ping', function (e) {
    var notification = webkitNotifications.createNotification(
      'test.png',
      'testTitle',
      'testContent'
    );
    notification.show();
}, false);

这些代码可以像正常的 html 页面http://localhost:8086/一样在 .

我已经放入http://localhost:8086/manifest.json 的“权限”。

4

0 回答 0