One of the biggest advantages of an extension over a GreaseMonkey script is the possibility of automatic update notification for the user. For my Greasemonkey statistics detector I’ve been looking in to a way to provide automatic update notification, without having to “phone home” on each use of the script. It’s not finished yet, but this is what I’ve come up with so far.
Using the GreaseMonkey functions
GM_getValue, I store the last date at which I checked for updates. If that date was more than 1 week ago, I make the script download a simple small “version.xml” file from my server, which would contain something like:
<?xml version="1.0" encoding="UTF-8"?> <statisticsdetector> <version>110</version> </statisticsdetector>
If that version is higher than the current version of the script, for instance, if you were using version 1 (100), it would be older than 1.1 (110) which is on the server, and you would get an unobtrusive popup to notify you that you should update. It will then store the date at which it checked, and won’t check for another week again.
Of course I will provide the code to this once it’s finished, but I was hoping some of you would have some ideas on this, and perhaps some good recommendations…