Greasemonkey auto-update notification

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_setValue and 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…

Tags: , ,


Yoast.com runs on the Genesis Framework

Genesis theme frameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides you with the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Read our Genesis review or get Genesis now!

1 Responses

  1. splintorBy splintor on 2 May, 2007

    I also looked for such an option – http://splintor.wordpress.com/2007/05/01/greasemonkey-wish-auto-update-user-scripts/

    As I said, I seem to have find a user script that does just that – http://userscripts.org/scripts/show/2296