Include

From FirebugWiki

(Difference between revisions)
Jump to: navigation, search
m (fix spelling mistake)
(Mention that jquery is proposed by default in the aliases)
 
(One intermediate revision not shown)
Line 22: Line 22:
=== alias ===
=== alias ===
Alias name for the included script. '''(optional for definition, required for usage)'''
Alias name for the included script. '''(optional for definition, required for usage)'''
 +
 +
'''New:''' Now by default, the "jquery" alias is proposed to get the ''jquery-latest.js'' script. So to include jquery, you can use the command below:
 +
 +
<source lang="javascript">
 +
include("jquery")
 +
</source>
== Example of use ==
== Example of use ==
Line 57: Line 63:
include(null, "vaporjs");
include(null, "vaporjs");
</source>
</source>
 +
 +
[[Category:Firebug]]
 +
[[Category:UI]]
 +
[[Category:API]]

Latest revision as of 11:06, 28 December 2013

Downloads and executes a remote script in a web page. Especially useful to import libraries for using them inside the Command Line.

Contents

[edit] Syntax

include()
include(url[, alias])
include(alias)

[edit] Parameters

If include() is written without parameters, it prints a table with all previously specified aliases.

[edit] url

URL of the script to include. If set to null, alias is removed. (optional)

[edit] alias

Alias name for the included script. (optional for definition, required for usage)

New: Now by default, the "jquery" alias is proposed to get the jquery-latest.js script. So to include jquery, you can use the command below:

include("jquery")

[edit] Example of use

The simplest usage is as follow:

include("http://code.jquery.com/jquery-latest.min.js")

If you often include 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:

IncludeTableExample.png

To remove an alias (for example, vaporjs), type this command:

include(null, "vaporjs");
Personal tools