Dive Into Greasemonkey

Teaching an old web new tricks

Name

GM_setValue — set script-specific configuration value

Synopsis

function GM_setValue(key, value);

Description

GM_setValue stores a script-specific configuration value. The key argument is a string of no fixed format. The value argument can be a string, boolean, or integer. Both arguments are required.

Greasemonkey configuration values are similar to browser cookies, but there are important differences. Both are stored on the local machine, but while cookies are domain-specific and can only be accessed from their originating domain, Greasemonkey configuration values are script-specific and can only be accessed by the user script that created them (regardless of the address the user script is currently running on). And unlike cookies, configuration values are never transmitted to remote servers.

History

GM_getValue was introduced in Greasemonkey 0.3.

See also

← GM_getValue
GM_registerMenuCommand →