Menu

GM_info

mmartz

Description

This special API object exposes some information to the script directly in the Greasemonkey context.

| Examples | See Also | Notes

Syntax

GM_info.property

Value: Object
Compatibility: Greasemonkey 0.9.16 - 3.12.0
Access: (Always available in or out of sandbox in Greasmonkey context only)

Properties

Properties
isIncognito / isPrivate script scriptMetaStr scriptSource scriptWillUpdate uuid version

Properties


isIncognito

isPrivate

Value: Boolean

  • Returns true if running in a private browsing window.

script

Value: script.name or script["name"]

Names
description excludes includes localizedName localizedDescription matches
name namespace noframes resources run-at version
  • Any value may be empty or an empty array.
script.description

Value: String

  • Returns the non-localized scripts @description value if available.

script.excludes

Value: Array of Strings

  • Returns the scripts @exclude value(s) if available.

script.includes

Value: Array of Strings

  • Returns the scripts @include value(s) if available.

script.localizedName

Value: String

  • Returns the scripts browser localized @name value if available.

script.localizedDescription

Value: String

  • Returns the scripts browser localized @description value if available.

script.matches

Value: Array of Strings

  • Returns the scripts @match value(s) if available.

script.name

Value: String

  • Returns the scripts non-localized @name value.

script.namespace

Value: String

script.noframes

Value: Boolean

  • Returns the scripts @noframes value if available.

script.resources

Value: Array of Strings

  • Returns the scripts @resource value(s) if available.

script["run-at"]

Value: String

  • Returns the scripts @run-at value.

script.version

Value: String

  • Returns the scripts @version value if available.

scriptSource

Value: String

  • Returns the current script source in entirety.

scriptMetaStr

Value: String

  • Returns the UserScript metadata block.

scriptWillUpdate

Value: Boolean

  • If the script has not been locally edited then this should return true for automatic updates assuming the @version has been appropriately set.

uuid

Value: String

  • Universally Unique Identifier label that is used to identify the script.

version

Value: String

Examples

Core

alert(GM_info.version);
alert(GM_info.script.version);

See Also

Notes

  • This is a Greasemonkey 3.x reference where there is currently no identification of the .user.js engine name ( i.e.scriptHandler or the like). Other .user.js engines may differ somewhat in their implementation.


Related

Wiki: Greasemonkey_Manual:API
Wiki: Metadata_Block