如何将jQuery插件添加到Chrome扩展程序Manifest.json [英] How to Add jQuery Plugin to Chrome Extension Manifest.json

查看:490
本文介绍了如何将jQuery插件添加到Chrome扩展程序Manifest.json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以让我知道如何将jQuery插件添加到Google Chrome扩展程序 manifest.json 文件中?

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,

推荐答案

您需要将其添加为内容脚本。它在chrome中有很好的记录: http://developer.chrome.com/extensions/tut_migration_to_manifest_v2.html 。最简单的方法是保存jquery的本地副本并将其与扩展一起发送,然后像manifest中那样引用它:

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

这篇关于如何将jQuery插件添加到Chrome扩展程序Manifest.json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆