Install/run userscripts with Google Chrome

Posted on

Problem :

Greasemonkey in Chrome is seriously driving me bonkers. It looks like all the “documentation” I can find online pre-2009 tells you to do things one way, and everything since then has been another way.

  1. What are the up-to-the-minute installation instructions for greasemonkey scripts? If something isn’t working, how can I debug it? Specifically, I want to install this script (which works fine in FFX). I’ve clicked the Install button, and it appears Chrome installed it as an extension, but the darn thing just doesn’t work.

  2. Possibly related to #1: I’m told that some userscripts are incompatible with Chrome. What specifically makes a script incompatible? If I’m comfortable with js programming, is it something I can fix on my own? I’ll move this question to stackoverflow if it’s inappropriate here…

  3. If I go to, is there a way I can tell which userscripts are active for that page?

Thanks for all your help.

Solution :

Chrome has built in Greasemonkey script support. If you have it as a file on your computer, just drag it into the chrome window. It should popup a message prompting you to install the script.

Try replacing the last line with:

function main() {
    document.addEventListener("keypress", keyPressEvent, true);
var script = document.createElement('script');
script.type = 'text/javascript';
script.appendChild(document.createTextNode('('+ main + ')();'));

Greasemonkey runs its scripts inside a sandbox. This should add the event listener outside of the sandbox. Might work better on Chrome.

Leave a Reply

Your email address will not be published. Required fields are marked *