Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing data in Greasemonkey scripts

Does GreaseMonkey have something built in so you can store data per-site or per-page? For example, say you wanted to tweak StackOverflow.com so you can add a note to each of the questions in your favorites list and sort on that note. Does GreaseMonkey have something built-in to store those notes? Or perhaps can the scripts self-modify, such that you just define an array or object and keep the data there?

like image 622
Joel Coehoorn Avatar asked Aug 12 '09 19:08

Joel Coehoorn


2 Answers

Yes - GM_setValue.

This method allows user script authors to persist simple values across page-loads. Strings, booleans, and integers are currently the only allowed data types

like image 172
bdonlan Avatar answered Sep 21 '22 19:09

bdonlan


The values are restricted to the simple datatypes: string, boolean and integer. The values will be stored in Firefox preferences (located in about:config) which is not designed for storing huge amounts of data.

http://wiki.greasespot.net/GM_setValue

If GM_setValue doesn't cut it the linked question/answers shows other great possibilities: alternatives to GM_setValue

like image 31
Mads Hoel Avatar answered Sep 22 '22 19:09

Mads Hoel