« Q4M becomes part of FreeBSD Ports Collection | Main | Greasemetal - the next step »

Greasemetal - a userscript runtime for Google Chrome

For more than two years, I have been using Firefox. And Greasemonkey. Then, last week, came Google Chrome. It was at the moment I tried the new browser that I suddenly noticed I could no more live without userscripts (especially, AutoPagerize). So I started looking into the source code of Google Chrome, and found out a way to implement a userscript runtime. And that's Greasemetal. It is now available from the link below.

Technically, Greasemetal executes userscripts in the following steps.

  1. setup a local web server that sends userscripts to Google Chrome
  2. launch Google Chrome specifying the browser to connect its AutomationProxy (an interprocess communication channel of the web browser implemented for automated UI tests) to Greasemetal
  3. periodically execute JavaScript in each browser tab that inserts <script> tags to download necessary userscripts from the local web server
As can be seen, since the entire userscript is run at the browser level, there is no support for GM_* functions (they require userscripts to be executed under a previleged environment for security reasons). In other word, some userscripts that rely on Greasemonkey-specific features would not work on Greasemetal. Userscripts compatible with Safari (or Opera) would mostly work.

The userscripts I checked and found compatible are;

This is the first release of Greasemetal, and it still lacks a number of features (especially the UI for managing userscripts). I hope I can release the next version early (hopefully a code-signed version), but if you find any bugs or have any suggestions, please let me know (although I am afraid I might not be able to answer to compatibility problems of each userscripts). Anyway, have fun!


GreaseMetal version: 0.1
Google Chrome version:

Problem: I'm getting a lot of errors that state "Uncaught TypeError: Cannot call method 'SetAutomationId' of undefinded" (you can see them if you were to right click on any part of a website, select Inspect element and then click on the stop sign in the lower right hand corner).

Thank you for reporting the problem.

I check the source code of Google Chrome, and the error message is a side effect of inserting userscripts.

Although it would not do any harm, I will minimize the display of the error message in the next version, since its certainly annoying (it seems impossible to completely eliminate the message).

Nice program! I would really like it if you can integrate your program into Google Chrome. That would be nice so I don't have to shortcut your program everywhere :).


I wrote for my own use a little userscript, it's for using the back/forward functions with the mouse buttons. If you do this: downright+downleft+upright+upleft it goes back, and if you do downleft+downright+upleft+upright it goes forward.

Just put this in a something.user.js file in the correct directory:

// ==UserScript==
// @name MouseHistory
// ==/UserScript==

var conm=true;

document.oncontextmenu = function(){return conm;};

var ar=new Array(4);

function enablecon(truefalse){
if(conm != truefalse){

function test(){

if(ar[4]==2 && ar[3]==4 && ar[2]==1 && ar[1]==3){

if(ar[4]==4 && ar[3]==2 && ar[2]==3 && ar[1]==1){

if((ar[3]==1 && ar[4]==4)||(ar[3]==2 && ar[4]==4)){enablecon(false);}


document.addEventListener('mousedown', function(event) {
}, true);

document.addEventListener('mouseup', function(event) {
}, true);

ok, thats it.

known limitation: it doesnt work on the first page chrome displays in empty tabs , aka the shortcuts page, because i think greasemetal doesnt work on them.


i think greasemetal doesnt work


I was having trouble at first, but now the problem was solved, thank you


is it possible to get this to work with SRWare iron since the iron browser is almost Identical to Chrome?

Thanks for the article. It works perfeclty fine at my side. Thank you kazuho for this nice article.

Thanks for the article. It works perfeclty fine at my side. Thank you kazuho for this nice article

hihi. I have a problem. When I run greasemonkey, chrome opens for a few milliseconds and then it closes immediately. May I know what's the problem and how I can resolve it? I have tried reinstalling chrome and greasemetal.


Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)