GreaseMonkey usefull APIs

Many of the GreaseMonkey users are not familiar with the very useful set of APIs it has to offer. These functions can help you, especially if you are using it for large projects. I will show here a few of the more useful APIs to my taste, you can read the entire API reference in the product wiki. Logging A very useful function is GM_log(). It is used to print log messages into the JavaScript console. Example: Storing data locally Use the functions GM_setValue(), GM_getValue(), GM deleteValue() and GM_listValues() to store and retract data on the client side. This data is located in the Firefox preferences mechanism. Example: Adding menu commands Another cool option is being able to add commands to be triggered from Firefox menu. To do that use the function GM_registerMenuCommand(). This adds a new item under “Tools->Greasemonkey->User Script Commands” Example: Ajax calls Use GM_xmlhttpRequest to make ajax calls very easily. Example: Further reading The full API reference