【问题标题】:How to Add jQuery Plugin to Chrome Extension Manifest.json如何将 jQuery 插件添加到 Chrome 扩展 Manifest.json
【发布时间】:2014-03-11 07:55:41
【问题描述】:

您能否告诉我如何将 jQuery 插件添加到 Google Chrome 扩展程序 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/"
  ]
}

谢谢,

【问题讨论】:

    标签: jquery google-chrome google-chrome-extension google-chrome-app


    【解决方案1】:

    您需要将其添加为内容脚本。它在 chrome 中有很好的记录: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"
          ]
        }
      ]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-07
      • 1970-01-01
      • 1970-01-01
      • 2012-08-15
      • 1970-01-01
      • 2018-02-24
      • 1970-01-01
      • 2019-02-08
      相关资源
      最近更新 更多