Sample Greasemonkey Script in Chrome to process local files

The following script will fire an alert box for local files:

// ==UserScript==
// @name Matcher
// @descriptions Match Local Files
// @version 1
// @match file://*
// ==/UserScript==

alert(1);

Save as “match.user.js”. Drop into a Chrome tab and you will be prompted to install. These are done per user profile. Each time you re-install the script, you need to remove the script from the extensions tab and repeat this process.

In order for this to work correctly, you need to open the Extensions settings in Chrome. You need to allow access to file urls, and incognito mode, if necessary.


(Click to enlarge)

Want to learn something new? I send out weekly, personalized emails with articles and conference talks. Click here to see an example and subscribe.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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