GM.info: Difference between revisions
From GreaseSpot Wiki
Jump to navigationJump to search
→Returns: isPrivate |
m name |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Description == | == Description == | ||
Line 8: | Line 7: | ||
== Syntax == | == Syntax == | ||
<pre class='sample'> | <pre class='sample'>GM.info</pre> | ||
== Returns == | == Returns == | ||
Line 14: | Line 13: | ||
This object has the following properties: | This object has the following properties: | ||
<!-- Not (yet?) in 4.x | |||
; isPrivate | ; isPrivate | ||
: A boolean, true when the current window is in private mode. (Also available as property <code>isIncognito</code>.) Compatibility: [[Version_history#3.8|Greasemonkey 3.8+]] | : A boolean, true when the current window is in private mode. (Also available as property <code>isIncognito</code>.) Compatibility: [[Version_history#3.8|Greasemonkey 3.8+]] | ||
--> | |||
; script | ; script | ||
: An object containing data about the currently running script. See more detail below. | : An object containing data about the currently running script. See more detail below. | ||
; scriptMetaStr | ; scriptMetaStr | ||
: A string, the entire literal [[Metadata Block]] (without the delimiters) for the currently running script. | : A string, the entire literal [[Metadata Block]] (without the delimiters) for the currently running script. | ||
<!-- not yet in 4.x | |||
; scriptWillUpdate | ; scriptWillUpdate | ||
: A boolean; when true Greasemonkey will attempt to auto-update the script. | : A boolean; when true Greasemonkey will attempt to auto-update the script. | ||
--> | |||
; scriptHandler | |||
: The name of the user script engine handling this script's execution. The string <code>Greasemonkey</code>. | |||
; version | ; version | ||
: The version of Greasemonkey, a string e.g. <tt>0 | : The version of Greasemonkey, a string e.g. <tt>4.0</tt>. | ||
---- | ---- | ||
Line 36: | Line 41: | ||
: Possibly empty array of strings. | : Possibly empty array of strings. | ||
; matches | ; matches | ||
: Possibly empty array of strings. | : Possibly empty array of strings. | ||
; name | ; name | ||
: String. | : String. | ||
Line 42: | Line 47: | ||
: Possibly empty string. | : Possibly empty string. | ||
; resources | ; resources | ||
: An object keyed by resource name. Each value is an object with keys <code>name</code> and <code>mimetype</code> and <code>url</code> with string values. | : An object keyed by resource name. Each value is an object with keys <code>name</code> and <code>mimetype</code> and <code>url</code> with string values. | ||
; run-at | ; run-at | ||
: String. | : String. | ||
; version | ; version | ||
: Possibly empty string. | : Possibly empty string. | ||
[[Category:API_Reference|I]] | [[Category:API_Reference|I]] |
Latest revision as of 15:18, 3 November 2017
Description
An object that exposes various information about Greasemonkey and the running User Script.
Compatibility: Greasemonkey 0.9.16+
Syntax
GM.info
Returns
This object has the following properties:
- script
- An object containing data about the currently running script. See more detail below.
- scriptMetaStr
- A string, the entire literal Metadata Block (without the delimiters) for the currently running script.
- scriptHandler
- The name of the user script engine handling this script's execution. The string
Greasemonkey
. - version
- The version of Greasemonkey, a string e.g. 4.0.
The script object contains structured fields from the Metadata Block:
- description
- Possibly empty string.
- excludes
- Possibly empty array of strings.
- includes
- Possibly empty array of strings.
- matches
- Possibly empty array of strings.
- name
- String.
- namespace
- Possibly empty string.
- resources
- An object keyed by resource name. Each value is an object with keys
name
andmimetype
andurl
with string values. - run-at
- String.
- version
- Possibly empty string.