Chrome扩展程序无法加载.json文件

时间:2016-11-30 14:14:23

标签: javascript json google-chrome-extension

我正在尝试将我的manifest.json文件加载到我的Chrome扩展程序中,但它给了我这个错误:cant'n load JavaScript file „_locales/YTplugin.js“

这就是我的manifest.json的样子:

 {
  // Required
  "manifest_version": 2,
  "name": "YouTube trending extension",
  "version": "0.1",

  // Recommended
  "default_locale": "en",
  "description": "YT extension",
  "icons": {},

  // Optional
  "author": "Josef Reischig",
  "chrome_url_overrides": {},
  "content_scripts": [{"matches": ["https://www.youtube.com/*"],"js": ["/_locales/YTplugin.js"]}]

}

我的YTplugin.js与manifest.json文件一起存储在_locales文件夹中。有人有想法吗?

1 个答案:

答案 0 :(得分:1)

尝试以下路径

"content_scripts": [{"matches": ["https://www.youtube.com/*"],"js": ["../_locales/YTplugin.js"]}]