如何在页面加载时通过Firebug注入JavaScript代码段? [英] How to inject JavaScript snippet via Firebug on page load?

查看:72
本文介绍了如何在页面加载时通过Firebug注入JavaScript代码段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Firebug Command Editor中注入一个JavaScript代码段,同时打开一个新标签并执行它。

I want to inject a JavaScript snippet in the Firebug Command Editor while opening a new tab and execute it.

以下是解释。

现在真正的问题开始了。
打开页面时,我希望在命令编辑器中显示一个片段。所以我只需要点击运行。如果可能,如果点击运行可以自动化,那就太棒了。

Now the real issue begins. When a page is opened I want a snippet to appear in the Command Editor. So I only have to click on Run. If possible, if clicking Run can be automatized then it would be great.

目的是自动化接受所有请求的过程,我目前必须手动完成。

The purpose is automatize the process of accepting all the requests, which I currently have to do manually.

推荐答案

Firebug允许通过其 include()命令。此命令还允许您为脚本提供别名,因此您可以使用该别名而不是脚本的URL。

Firebug allows to include and execute external JavaScript files via its include() command. This command also allows you to provide an alias for the script, so you can use that one instead of the script's URL.

包含脚本的命令的语法(并为它存储别名)如下所示:

The syntax of the command for including the script (and storing an alias for it) looks like this:

include(url[, alias])

其中 url 是您要包含的脚本的URL字符串, alias URL的可选别名字符串。

where url is the URL string of the script you want to include and alias the optional alias string for the URL.

如果为其存储了别名,则可以将其称为这个:

If you stored an alias for it, you can then call it like this:

include(alias)

如果要查看所有别名的列表,可以不带参数调用该命令:

If you want to see a list of all aliases, you can call the command without parameters:

include()

要删除别名,你必须像这样调用命令:

And to remove an alias you have to call the command like this:

include(null, alias)

Firebug(最多2.0)不提供存储在其命令编辑器。建议将此功能作为问题6951 作为命令编辑器的UI并作为问题6201 中的命令。

Firebug (up to 2.0) doesn't provide storing arbitrary snippets entered into its Command Editor yet, though. This feature is suggested as issue 6951 as UI for the Command Editor and as a command in issue 6201.

此外,还没有实现页面加载时JavaScript的自动执行。这在问题6303 中有要求。

Also automatic execution of JavaScript on page load isn't implemented yet. This is requested in issue 6303.

这篇关于如何在页面加载时通过Firebug注入JavaScript代码段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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