我正在尝试使用以下内容打开丰富的通知:
var options = {
templateType: "basic",
title: "John Doe",
message: "Lorem ipsum",
iconUrl: "https://www.MyExternalURL.com/image.jpg"
};
chrome.experimental.notification.create("notifyId", options, function(id) {
console.log("Succesfully created notification");
});
但由于某种原因,这不起作用,但如果我用以下内容替换选项:
var options = {
templateType: "basic",
title: request.name,
message: request.message,
iconUrl: chrome.runtime.getURL("/images/cat.png"),
};
并且通知工作得很好。
这是我的清单文件中的重要内容
{
"manifest_version": 2,
"name": ...,
"description": ...,
"version": ...,
"icons": {
...
},
"content_scripts": [
...
],
"background": {
"scripts": ["background.js"]
},
"permissions": [
"tabs",
"experimental"
],
"web_accessible_resources": [
"https://www.MyExternalURL.com/*"
]
}
我应该如何使用外部图像作为 iconURL?