相关疑难解决方法(0)

如何在Google Chrome中的Greasemonkey脚本中使用jQuery?

正如你们中的一些人可能知道的那样,谷歌Chrome对Greasemonkey脚本有一些严重的限制.

铬不支持@require,@resource,unsafeWindow,GM_registerMenuCommand,GM_setValue,或GM_getValue.

没有require,我找不到在Google Chrome下的Greasemonkey脚本中包含jQuery库的方法.

有人在这件事上有一些建议吗?

jquery greasemonkey google-chrome require userscripts

155
推荐指数
6
解决办法
6万
查看次数

为什么jQuery不能在Chrome用户脚本(Greasemonkey)中运行?

可能重复:
如何在Google Chrome中的Greasemonkey脚本中使用jQuery?

我无法让此用户脚本在Google Chrome中运行.

// ==UserScript==
// @name           voip
// @namespace      1
// @description    voip
// @include        *
// @require        http://jquery.com/src/jquery-latest.js
// ==/UserScript==

$(document).ready(function() {  
        alert("Hello world!");
});
Run Code Online (Sandbox Code Playgroud)

警报未显示.如果我只是放入alert("Hello world!");脚本,它就可以了.

如何在Chrome用户脚本中使用jQuery?

jquery google-chrome userscripts

17
推荐指数
3
解决办法
1万
查看次数

在AJAX中仅检索远程URL的一部分

我尝试在Google上搜索并阅读文档 但没有成功.我正在使用contentScript(chrome扩展)或firefox用户称为greasemonkey脚本来制作ajax请求.

使用AJAX获取URL的典型函数,

function getURL(url, element)
{
    var request = new XMLHttpRequest();
    request.onreadystatechange = function()
    {   
        if ( request.readyState == 4 ) 
        {   
            callback( request.responseText, element, request.status );    
        }   
    };  
    request.open( "GET", url, true );
    request.send()
}
Run Code Online (Sandbox Code Playgroud)

可以说我只需要第一个10kb的页面,但是whole size of page is more than 200kb.我正在检索的页面是普通的HTML.我不想waste the bandwidth by downloading the excess 190kb.有没有办法实现这一目标?另外,如果只检索100kb到110kb的页面的一部分可能吗?

我对浏览器特定的解决方案(chrome)持开放态度.我必须将扩展程序移植到Firefox,所以也欢迎这方面的想法.

javascript ajax http firefox-addon google-chrome-extension

2
推荐指数
1
解决办法
440
查看次数