Interface VMScriptGMInfoObject

interface VMScriptGMInfoObject {
    injectInto: VMScriptInjectInto;
    platform: VMScriptGMInfoPlatform;
    script: VMScriptGMInfoScriptMeta;
    scriptHandler: string;
    scriptMetaStr: string;
    scriptWillUpdate: boolean;
    userAgent: string;
    userAgentData?: {
        brands: {
            brand: string;
            version: string;
        }[];
        mobile: boolean;
        platform: string;
        getHighEntropyValues(hints): Promise<UADataValues>;
    };
    uuid: string;
    version: string;
}

Properties

injectInto: VMScriptInjectInto

The injection mode of current script.

Unlike navigator.userAgent, which can be overriden by other extensions/userscripts or by devtools in device-emulation mode, GM_info.platform is more reliable as the data is obtained in the background page of Violentmonkey using a specialized extension API (browser.runtime.getPlatformInfo and getBrowserInfo).

Contains structured fields from the Metadata Block.

scriptHandler: string

The name of userscript manager, which should be the string Violentmonkey.

scriptMetaStr: string

The meta block of the script.

scriptWillUpdate: boolean

Whether the script will be updated automatically.

userAgent: string

A copy of navigator.userAgent from the content script of the extension.

Since

VM2.20.2

userAgentData?: {
    brands: {
        brand: string;
        version: string;
    }[];
    mobile: boolean;
    platform: string;
    getHighEntropyValues(hints): Promise<UADataValues>;
}

A copy of navigator.userAgentData from the content script of the extension. Not present in browsers that don't implement this API.

Type declaration

  • brands: {
        brand: string;
        version: string;
    }[]
  • mobile: boolean
  • platform: string
  • getHighEntropyValues:function
    • Parameters

      • hints: string[]

      Returns Promise<UADataValues>

Since

VM2.20.2

uuid: string

Unique ID of the script.

version: string

Version of Violentmonkey.