Google chrome extension Firefox插件中的chrome扩展名:/

Google chrome extension Firefox插件中的chrome扩展名:/,google-chrome-extension,firefox-addon,Google Chrome Extension,Firefox Addon,我正在将Chrome扩展移植到Firefox。在Chrome扩展中,我指的是Chrome扩展下的资源://+Chrome.runtime.id 福巴={ 配置:{ fontURL:chrome扩展名://+chrome.runtime.id+//fonts } }; 如何将其转换为Firefox?Firefox会随机化id,因此即使您编写moz extension://它也不会帮助您 使用chrome.runtime.getURL,如中所述: chrome名称空间在Firefox和chrome

我正在将Chrome扩展移植到Firefox。在Chrome扩展中,我指的是Chrome扩展下的资源://+Chrome.runtime.id

福巴={ 配置:{ fontURL:chrome扩展名://+chrome.runtime.id+//fonts } };
如何将其转换为Firefox?

Firefox会随机化id,因此即使您编写moz extension://它也不会帮助您

使用chrome.runtime.getURL,如中所述:

chrome名称空间在Firefox和chrome中都可以使用

有关移植Chrome扩展和不兼容性的更多信息:

let foobar = {
  config: {
    fontURL: chrome.runtime.getURL("/fonts")
  } 
};