Server-side Greasemonkey

Posted on 6 Jun 2008

Today's Gmail Labs announcement got me thinking about ways to allow users to customise a site. Greasemonkey is amazing but the problem is that the scripts are stored with the browser on the client-side. So if I install a script to enhance Gmail on my desktop, I will still get the unenhanced version when I log into Gmail on my laptop. But since the user script is just a bit of JavaScript, couldn't Gmail allow me to install the user script on the server and then serve it back to me wherever I choose to access Gmail from? It's only serving me the scripts I installed so it's no more of a security risk than client-side Greasemonkey.

Of course, it would require support from the website owner but, in the case of popular sites like Gmail and Facebook for which thousands of user scripts already exist, the increase in customer satisfaction would surely be worth the minimal effort. Also this would only work on sites that require a login since you need to know who to serve which scripts to.

A quick search led me to Monkeygrease but that's not at all what I have in mind. They use a Java servelet to preprocess pages rendered by closed source web applications.

My suggestion is much simpler:

  1. Create a JavaScript version of the Greasemonkey environment which can be included into any HTML page
  2. Create an interface to allow users of the site to upload user scripts
  3. Store the scripts on the server
  4. Append the Greasemonkey environment and all installed user scripts to every HTML page served to the user

Is there a reason this doesn't already exist? Does anyone know of any projects going on in this area?