GM.info: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
Lil Devil (talk | contribs)
→‎Returns: Changed from a negative (bug) to a positive (bug fixed)
→‎Returns: isPrivate
Line 14: Line 14:
This object has the following properties:
This object has the following properties:


; 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+]]
; 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.

Revision as of 14:18, 2 August 2016

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:

isPrivate
A boolean, true when the current window is in private mode. (Also available as property isIncognito.) Compatibility: Greasemonkey 3.8+
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.
scriptWillUpdate
A boolean; when true Greasemonkey will attempt to auto-update the script.
version
The version of Greasemonkey, a string e.g. 0.9.16.

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. Compatibility: Greasemonkey 0.9.18+
name
String.
namespace
Possibly empty string.
resources
An object keyed by resource name. Each value is an object with keys name and mimetype and url with string values. (Note url was added as of Greasemonkey version 3.6.)
run-at
String.
unwrap
Boolean.
version
Possibly empty string.