用Greasemonkey替换页面的jQuery版本 [英] Replace jQuery version of a page with Greasemonkey

查看:82
本文介绍了用Greasemonkey替换页面的jQuery版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何用油脂猴子替换页面的jquery版本?

How can i replace jquery version of a page with greasemonkey?

我正在尝试使用更新版本的jquery测试网站,但我没有开发环境.

Im trying to test a site with a newer version of jquery but i dont have a dev enviroment.

推荐答案

我知道您是在询问jQuery和Greasemonkey这样做的问题,但是让我完全 个替代选择提琴手.

I know you're asking about jQuery and Greasemonkey for doing this, but let me off a completely different alternative, Fiddler.

如果您要使用新版本的jQuery测试网站,而您实际上想要测试任何重大更改,等等...您想要测试网站,因为它将是,而基于JavaScript(油脂猴子)的事后替换并不是准确的模拟.

If you're testing a site out with a new version of jQuery and you actually want to test any breaking changes, etc...you want to test the site as it will be, whereas a JavaScript (greasemonkey)-based after-the-fact replacement isn't an accurate simulation.

使用小提琴手可以替换浏览器请求的jQuery文件 (浏览器不知道).这样一来,您实际上就可以对其进行完整的测试,就可以直接将新版本放到页面中,而页面内的JS技巧也可能不那么准确(处理程序已经连接,加载顺序等). )

With fiddler you can replace the jQuery file that the browser requests (without the browser knowing). This way you're actually testing it completely, you're straight up dropping the new version in the page, no in-page JS tricks which may not be at all accurate to get there (handlers already hooked up, load order, etc.)

Eric Law (Fiddler的创建者)在有关如何执行<完全是:

Eric Law (creator of Fiddler) has an excellent blog post on how to do exactly this:

该帖子是为将缩小版本与完整版本(也很方便!)换成 或为较新版本进行调试而写的,请务必注意这两种用法...它们都是非常对于节省一些调试/测试时间很有用.

The post was written for swapping out the minified version with the full version (also handy!) or a newer version for debugging, be sure to note both uses...they're both very useful in saving some debug/testing time.

这篇关于用Greasemonkey替换页面的jQuery版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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