GM.setValue: Difference between revisions
From GreaseSpot Wiki
Jump to navigationJump to search
about:config |
|||
Line 2: | Line 2: | ||
{{underscore|title=GM_setValue}} | {{underscore|title=GM_setValue}} | ||
= Syntax = | == Syntax == | ||
'''GM_setValue(''' ''name'', ''value'' ''')''' | '''GM_setValue(''' ''name'', ''value'' ''')''' | ||
Line 11: | Line 11: | ||
Strings, booleans, and integers are the only allowed data types. | Strings, booleans, and integers are the only allowed data types. | ||
Values are stored in the [http://developer.mozilla.org/en/docs/Code_snippets:Preferences Firefox preferences] back end. | Values are stored in the [http://developer.mozilla.org/en/docs/Code_snippets:Preferences Firefox preferences] back end and can be changed by typing <code>about:config</code> in the address bar and searching for the preference name "greasemonkey.scriptval.''script-namespace''/''script-name''. | ||
This places limitations on the size of an individual value, and the number of values. | This places limitations on the size of an individual value, and the number of values. | ||
(This statement may not be accurate. Please see [http://groups.google.com/group/greasemonkey-users/t/ca5a0dfac5c5998b this mailing list thread] for details.) | (This statement may not be accurate. Please see [http://groups.google.com/group/greasemonkey-users/t/ca5a0dfac5c5998b this mailing list thread] for details.) | ||
= Examples = | == Examples == | ||
alert(GM_setValue("foo", "bar")); | alert(GM_setValue("foo", "bar")); | ||
= See | == See also == | ||
* [[GM_getValue]] | * [[GM_getValue]] |
Revision as of 01:52, 23 September 2007
Syntax
GM_setValue( name, value )
Description
Allows user script authors to persist simple values locally. Strings, booleans, and integers are the only allowed data types.
Values are stored in the Firefox preferences back end and can be changed by typing about:config
in the address bar and searching for the preference name "greasemonkey.scriptval.script-namespace/script-name.
This places limitations on the size of an individual value, and the number of values.
(This statement may not be accurate. Please see this mailing list thread for details.)
Examples
alert(GM_setValue("foo", "bar"));