Google Chrome 内容脚本中的 jQuery? [英] jQuery in Google Chrome Content Script?
本文介绍了Google Chrome 内容脚本中的 jQuery?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将如何将 jQuery 库包含在我的 Google Chrome 内容脚本中?我试过了,当然没有结果.我应该使用 <script src="..."/></script>
,还是有不同的/更好的方法来解决这个问题?提前致谢!
How would I go about including the jQuery library in my Google Chrome Content Script? I have tried, fruitlessly, of course. Should I use <script src="..." /></script>
, or is there a different/better way to go about it? Thanks in advance!
推荐答案
将其放入背景 html 并不能满足您的要求.您需要在 manifest.json 中提及它,如下所示:
Putting it into your background html doesn't do what you want. You need to mention it in your manifest.json, like this:
{
"name": "MyExtension",
"version": "0.1",
"description": "blah blah",
"background_page": "background.html",
"content_scripts": [
{
"matches": ["http://*/*","https://*/*"],
"css": ["extension.css"],
"js": ["jquery-1.4.2.js", "extension.js"]
}
]
}
这篇关于Google Chrome 内容脚本中的 jQuery?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文