一个前端,爱跑步、爱吉他、爱做饭、爱生活、爱编程、爱南芳姑娘,爱我所爱。世间最温暖又无价的是阳光、空气与爱,愿它们能带你去更远的地方。

  • 文章
  • 心情
  • 照片墙
  • 留言板
  • 工具
  • 友链
  • biaoblog

    专注web开发技术分享

    chrome访问本地静态资源

    技术 202 2022-01-11 13:33

    以img和iframe以例子:

    1.在manifest中添加web_accessible_resources声明静态资源地址:

     "web_accessible_resources": ["iframes/test.html"]
    

    然后进行引入:

    URL = chrome-extension://插件ID/iframes/test.html
    
    

    注意 :因为插件的id是动态的 所以需要动态的获取

    css中:__MSG_@@extension_id__

    src: url(chrome-extension://__MSG_@@extension_id__/css/fonts/element-icons.woff) format("woff")
    

    js中:chrome.runtime.getURL("iframes/notSupport.html")

    src="${chrome.runtime.getURL("iframes/notSupport.html")}"
    

    文章评论

    评论列表(0