Include
From FirebugWiki
(first draft) |
(Better example of use (inspired from the example given by Honza: https://blog.getfirebug.com/2012/11/02/firebug-1-11-alpha-6/)) |
||
| (One intermediate revision not shown) | |||
| Line 1: | Line 1: | ||
| - | Downloads and executes a remote script in a web page. | + | Downloads and executes a remote script in a web page. Especially useful to import libraries for using them inside the [[Command Line]]. |
== Syntax == | == Syntax == | ||
| + | <source lang="javascript"> | ||
| + | include() | ||
| + | </source> | ||
| - | = | + | <source lang="javascript"> |
| - | + | include(url[, alias]) | |
| - | + | </source> | |
| - | + | ||
| - | = | + | <source lang="javascript"> |
| - | + | include(alias) | |
| - | + | </source> | |
| - | + | ||
| - | + | ||
| - | === include( | + | == Parameters == |
| - | + | If <code>include()</code> is written without parameters, it prints a table with all previously specified aliases. | |
| - | + | ||
| - | + | ||
| - | === | + | === url === |
| - | + | URL of the script to include. If set to <code>null</code>, alias is removed. '''(optional)''' | |
| - | == | + | === alias === |
| - | + | Alias name for the included script. '''(optional for definition, required for usage)''' | |
| - | + | == Example of use == | |
| + | The simplest usage is as follow: | ||
<source lang="javascript"> | <source lang="javascript"> | ||
| - | include("http://code.jquery.com/jquery-latest.js") | + | include("http://code.jquery.com/jquery-latest.min.js") |
</source> | </source> | ||
| - | + | If you often including the same script (e.g. jqueryfying your page), you can create a handy alias: | |
| - | |||
<source lang="javascript"> | <source lang="javascript"> | ||
| - | include("http://code.jquery.com/jquery-latest.js", "jquery") | + | include("http://code.jquery.com/jquery-latest.min.js", "jquery") |
</source> | </source> | ||
| - | and reuse it | + | and reuse it like below: |
| + | |||
<source lang="javascript"> | <source lang="javascript"> | ||
| - | include("jquery") | + | include("jquery") |
</source> | </source> | ||
| - | + | Note, that aliases are persistent across Firefox restarts. | |
| + | |||
| + | To list the aliases, you are offered this command: | ||
<source lang="javascript"> | <source lang="javascript"> | ||
include(); | include(); | ||
| Line 51: | Line 52: | ||
[[File:IncludeTableExample.png]] | [[File:IncludeTableExample.png]] | ||
| - | + | To remove an alias (for example, vaporjs), type this command: | |
| + | |||
<source lang="javascript"> | <source lang="javascript"> | ||
include(null, "vaporjs"); | include(null, "vaporjs"); | ||
</source> | </source> | ||
| - | |||
| - | |||
Revision as of 12:21, 5 November 2012
Downloads and executes a remote script in a web page. Especially useful to import libraries for using them inside the Command Line.
Contents |
Syntax
include()
include(url[, alias])
include(alias)
Parameters
If include() is written without parameters, it prints a table with all previously specified aliases.
url
URL of the script to include. If set to null, alias is removed. (optional)
alias
Alias name for the included script. (optional for definition, required for usage)
Example of use
The simplest usage is as follow:
include("http://code.jquery.com/jquery-latest.min.js")
If you often including the same script (e.g. jqueryfying your page), you can create a handy alias:
include("http://code.jquery.com/jquery-latest.min.js", "jquery")
and reuse it like below:
include("jquery")
Note, that aliases are persistent across Firefox restarts.
To list the aliases, you are offered this command:
include();
And you are returned this table:
To remove an alias (for example, vaporjs), type this command:
include(null, "vaporjs");
