简体   繁体   中英

Include ttf files in chrome extension content script

I am using a content script to inject some HTML into a webpage. I am trying to use the google font, CabinCondensed-Regular, and a number of icon fonts gotten from 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. Normally you could specify a file by "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?

看起来您可以使用"web_accessible_resources"来链接您的字体文件(而不是"content_scripts" 。然后只需确保您的@font-face路径对于字体文件是正确的。请参阅: https//developer.chrome.com/extensions /清单/ web_accessible_resources

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM