简体   繁体   English

使用jQuery的Chrome扩展程序

[英]Chrome Extension using jQuery

I created a script that add functions to a site, wherever it uses variables and functions from this site including jQuery. 我创建了一个向网站添加函数的脚本,无论它在哪里使用此站点(包括jQuery)中的变量和函数。 I tried to attach this script to the site through of Chrome Extension. 我试图将此脚本通过Chrome扩展程序附加到网站。 But the extension don't work. 但是扩展名不起作用。 I read about this limitation on http://code.google.com/chrome/extensions/content_scripts.html . 我在http://code.google.com/chrome/extensions/content_scripts.html上了解了此限制。 Do have another manner to do this? 是否有其他方法可以做到这一点?

My English is poor, and I can't understanding alright the examples on net. 我的英语很差,我无法完全理解网上的示例。

Could you add some code to your question and explain what problem you're having? 您可以在问题中添加一些代码并解释您遇到的问题吗?

It's very hard to know what's going wrong with your extension without seeing any code or knowing what your goal is, or what's going wrong. 在不查看任何代码或不知道您的目标是什么或出了什么问题的情况下,很难知道扩展程序出了什么问题。

If you're having trouble using jQuery, make sure you've included it in the manifest, something like this: 如果您在使用jQuery时遇到问题,请确保已将其包含在清单中,如下所示:

{
    "name" : "Foo",
    "version" : "1.0.0",
    "description" : "Do some foo thing",
    "content_scripts" : [
        {
            "matches" : [
                "http://*/*",
                "https://*/*"
            ],
            "js" : ["js/jquery-1.6.1.js", "js/myContentscript.js"],
            "run_at" : "document_end"
        }
    ],
    "icons" : {
        "16" : "images/16.png",
        "22" : "images/22.png",
        "32" : "images/32.png",
        "48" : "images/48.png",
        "128" : "images/128.png"
    }
}

Also make sure the jQuery file is actually in your package. 还要确保jQuery文件实际上在您的程序包中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM