GM.getResourceText: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
m Reverted edits by 123.238.10.74 (Talk) to last revision by Arantius
m Arantius moved page GM getResourceText to GM.getResourceText: Greasemonkey 4.0
(No difference)

Revision as of 14:32, 3 November 2017


Description

Given a defined @resource, this method returns it as a string.

Compatibility: Greasemonkey 0.8.0+

Syntax

function GM_getResourceText( resourceName )

Arguments

resourceName
String The name provided when the @resource was defined, follow that link for valid naming restrictions.

Returns

String

Raises

Throws an Error when the named resource does not exist.

Examples

// ==UserScript==
// @resource prototype http://www.example.com/prototype.js
// ==/UserScript==

var prototypeSource = GM_getResourceText("prototype");

See Also