如何将 jQuery 插件添加到 Chrome 扩展 Manifest.json.



你能告诉我如何将jQuery插件添加到谷歌浏览器扩展manifest.json文件中吗?

{
  "manifest_version": 2,
  "name": "One Pass",
  "description": "This is a Development.",
  "version": "1.0",
  "browser_action": {
    "default_icon": "icon.png",
    "default_popup": "popup.html"
  },
  "permissions": [
    "https://secure.flickr.com/"
  ]
}

谢谢

您需要将其添加为内容脚本。这在铬中得到了很好的记录:http://developer.chrome.com/extensions/tut_migration_to_manifest_v2.html。最简单的方法是保留jquery的本地副本并将其与扩展一起提供,然后在manifest.json中引用它,如下所示:

 "content_scripts": [
    {
    "all_frames": false,
    "matches": ["<all_urls>"],
    "exclude_matches": [],
      "js": [
        "js/lib/jquery.js"
      ],
      "css": [
        "js/content/page.css"
      ]
    }
  ]

最新更新