Google chrome extension 清单v3资源必须列在web\u可访问\u资源中
即使在manifest.json中正确声明了“image/copy.svg”,也会出现此错误Google chrome extension 清单v3资源必须列在web\u可访问\u资源中,google-chrome-extension,Google Chrome Extension,即使在manifest.json中正确声明了“image/copy.svg”,也会出现此错误 "manifest_version": 3, "content_scripts": [ { "matches": ["https://*.example.com/*"], "js": ["contents/results.js"],
"manifest_version": 3,
"content_scripts": [
{
"matches": ["https://*.example.com/*"],
"js": ["contents/results.js"],
"css": ["css/style.css"],
"run_at": "document_end"
}
],
"web_accessible_resources": [{
"resources": ["images/copy.svg"],
"matches": [],
"extension_ids": []
}],
拒绝负载
铬-extension://pofbdjeepddggbelfghnndllidnalpde/images/copy.svg.
资源必须列在web\u可访问\u资源清单键中
以便由扩展以外的页面加载
如果我去chrome-extension://pofbdjeepddggbelfghnndllidnalpde/images/copy.svg 我可以成功地看到加载的图像
css/style.css
.copy-icon{
content:url('chrome-extension://__MSG_@@extension_id__/images/copy.svg');
height: 16px;
width: auto;
margin-right: 0px;
}
html
<button alt="Copy to clipboard" class="clipboard" data-clipboard-text="TEXT">
<img class="copy-icon"></img>
</button>
匹配
键应指定在何处公开这些资源。您可以使用
在任何地方公开它们
“网络可访问资源”:[{
“资源”:[“images/copy.svg”],
“匹配项”:[“”],
}],