GM.getResourceText: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
m Reverted edits by 86.126.117.107 (Talk) to last revision by Arantius
Line 23: Line 23:


Throws an <code>Error</code> when the named resource does not exist.
Throws an <code>Error</code> when the named resource does not exist.
[http://www.e-jocurionline.org Jocuri Online]
[http://www.triluliludownload.info Trilulilu]


== Examples ==
== Examples ==

Revision as of 13:22, 6 September 2010


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