How to Add jQuery Plugin to Chrome Extension Manifest.json

那年仲夏 提交于 2019-12-25 02:48:12

问题


Can you please let me know how I can add a jQuery plugin into a Google Chrome extension manifest.json file?

{
  "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/"
  ]
}

Thanks,


回答1:


You would need to add it as a content script. It's very well documented in the chrome : http://developer.chrome.com/extensions/tut_migration_to_manifest_v2.html. Easiest is to keep a local copy of jquery and ship it with the extension and then refer it in your manifest.json like so :

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

      "css": [
        "js/content/page.css"
      ]
    }
  ]


来源:https://stackoverflow.com/questions/21737281/how-to-add-jquery-plugin-to-chrome-extension-manifest-json

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!