如何使用本地 javascript 文件使用 firebug(或 Chrome)在实时站点上进行测试?
我有一些自定义 JS,希望将其部署到实时站点上,但我想先对其进行测试。
我是目标站点管理者的第三方顾问,并且不参与他们的构建过程,因此我无法在他们的测试环境中进行部署。由于它是一个 DOM 遍历库,因此非常具体。
我想知道是否有人知道如何让我的本地 javascript 文件自动插入特定域或主机。
谢谢!
I've got some custom JS that i'm looking to deploy on a live site, but I want to test it out first.
I'm a third-party consultant to the target site managers, and am not part of their build process, so I can't deploy in their test environments. Since it's a DOM traversal library, it's pretty specific.
I was wondering if anyone knew how to get my local javascript files to auto-insert for a particular domain or host.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不直接在 firebug 的控制台中注入您正在处理的脚本:
或者如果您有 jQuery
Why not just inject the script you're working on in firebug's console:
Or if you have jQuery
安装适用于 Firefox 的 Greasemonkey 插件。
此附加组件可以为某些 URL 与注入的 JS 文件中给出的正则表达式匹配的页面注入 Javascript。
如果您想了解其他人如何编写 Greasemonkey 脚本,请搜索以“BetterXYZ”开头的 FF 附加组件,例如 BetterGmail、BetterFacebook、BetterGoogle ...
Greasemonkey-Skripts 实际上是带有特殊初始 JS 注释和特殊文件扩展名“*.user.js”的 Javascript 文件。
Install Greasemonkey Add-On for Firefox.
This Add-On can inject Javascript for pages with certain URLs matching a regex given in the injected JS-file.
If you want to learn how others are writing their Greasemonkey-Scripts then search for FF Add-Ons that start with "BetterXYZ" like BetterGmail, BetterFacebook, BetterGoogle ...
Greasemonkey-Skripts are in fact Javascript-Files with special initial JS-Comment and a special file extension "*.user.js".