且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为何SVG无法加载到Chrome扩展程序中?

更新时间:2023-12-05 18:55:28

在注入的代码中,相对路径(例如"SVG/home-outline.svg")指向您要注入的站点.

In the injected code, relative paths like "SVG/home-outline.svg" point to the site you're injecting to.

您需要扩展中资源的完整路径.很容易得到它: chrome.runtime.getURL("SVG/home-outline.svg")可以完成工作.

You need a full path to the resource in your extension. It's easy to get it: chrome.runtime.getURL("SVG/home-outline.svg") does the job.