Google chrome extension 来自后台脚本的桌面通知

Google chrome extension 来自后台脚本的桌面通知,google-chrome-extension,Google Chrome Extension,我是chrome扩展开发的初学者。我正在尝试在后台脚本完成某些方法时显示桌面通知,但我不知道如何为此请求权限。有没有办法完成这项任务 可以使用内容脚本完成,但我希望通过后台脚本显示通知,而不显示后台页面。您需要将通知添加到manifest.json文件中: "permissions": ["tabs", "notifications","management"] 然后你可以打电话 webkitNotifications.createNotification('images/message48.

我是chrome扩展开发的初学者。我正在尝试在后台脚本完成某些方法时显示桌面通知,但我不知道如何为此请求权限。有没有办法完成这项任务


可以使用内容脚本完成,但我希望通过后台脚本显示通知,而不显示后台页面。

您需要将通知添加到manifest.json文件中:

"permissions": ["tabs", "notifications","management"]
然后你可以打电话

webkitNotifications.createNotification('images/message48.png', title, message);

非常感谢,我在我的舱单上错过了这个许可,决定很简单