GM.info: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
Update for 4.0
m Arantius moved page GM info to GM.info
(No difference)

Revision as of 14:29, 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 and mimetype and url with string values.
run-at
String.
version
Possibly empty string.