From GreaseSpot Wiki
Revision as of 20:53, 5 May 2009 by Marti (talk | contribs) (→‎Storing large amounts of data: Reply for Skagedal)
Jump to navigationJump to search


How can I clear values from Firefox preferences set by my Greasemonkey script?
Currently there is no API for this.


The previous incarnation of this article had an example of alert(GM_setValue("foo", "bar"));. Currently miscapis.js and prefmanager.js does not have any return statements.
If this is a desired behavior for GM developers to pursue, it will need to be corrected in the trunk.

Storing large amounts of data

So what if I do need to store large amounts of data? Is there any other API that allows for that? /Skagedal 16:12, 5 May 2009 (EDT)

@Skagedal Do some stress testing on your browser and also take into account that other machines may be slower than yours. I've done some tests on some of my own scripts and it almost never slows down the startup procedure. There are usually limits on a single preference though... keep that in mind too. Local Storage hopefully will be implemented properly sometime soon. Marti 16:22, 5 May 2009 (EDT)

Thank you for the quick reply! I actually haven't written any code yet, currently just investigating the feasability of using Greasemonkey for my project. So, do you think it would be better with many small (I'm talking around 1000 to 100000) pairs of key/value, than encoding them all into one big value? /Skagedal 16:34, 5 May 2009 (EDT)
You will just have to try and see what happens... Some systems have a 64K limit on a preference value too... usually I have a really slow machine around to compare results too. Also added stuff to the main GM Manual page for support. Marti 16:53, 5 May 2009 (EDT)