[英]Include ttf files in chrome extension content script
I am using a content script to inject some HTML into a webpage. 我正在使用内容脚本将一些HTML注入网页。 I am trying to use the google font, CabinCondensed-Regular, and a number of icon fonts gotten from IcoMoon.
我正在尝试使用谷歌字体,CabinCondensed-Regular,以及从IcoMoon获得的一些图标字体。 I have downloaded the files and am including them in the CSS with
@font-face
, because from what I can tell it's faster, but I don't know how to include them in the manifest.json. 我已经下载了这些文件并将它们包含在带有
@font-face
的CSS中,因为我可以告诉它更快,但我不知道如何将它们包含在manifest.json中。 Normally you could specify a file by "content_scripts": [ 通常你可以通过“content_scripts”指定一个文件:[
{
"matches": [ "<all_urls>"],
"css":["style.css", "jquery-ui.css"],
"js":["jquery-2.1.0.min.js", "index.js", "jquery-ui.min.js"],
}
but as far as I can tell there is no specific tag for fonts, so how can I include the ttf files? 但据我所知,字体没有特定的标签,那么如何包含ttf文件呢?
看起来您可以使用"web_accessible_resources"
来链接您的字体文件(而不是"content_scripts"
。然后只需确保您的@font-face
路径对于字体文件是正确的。请参阅: https : //developer.chrome.com/extensions /清单/ web_accessible_resources
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.