Google Chrome is built with open source code from Chromium.

Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution 2.5 license, and examples are licensed under the BSD License.
For Developers‎ > ‎Design Documents‎ > ‎

User Scripts

Current Chromium development builds have rudimentary support for user scripts.

To use:
  • Install a recent trunk build of Chromium, or switch to the dev channel.
  • Launch chrome.exe with the --enable-user-scripts flag.
  • Create a directory called User Scripts in your user data directory.
  • Copy *.user.js files to the script directory.
  • Script edits are picked up automatically; just refresh the page to see the changes.
Known issues:
  • Chromium does not support @exclude, @require, @resource, unsafeWindow, or any of the special GM_* APIs.
These instructions will be updated as the Greasemonkey support in Chromium improves.

Match Patterns

The preferred way to specify the pages that a user script should run against in Chromium is the @match attribute. Here are some examples of its use:

// ==UserScript==
// @match http://*
// @match http://*.google.com/*
// @match http://www.google.com/*
// ==/UserScript==

See these comments for details on the @match syntax. 

Support for Greasemonkey-style @include patterns is also currently implemented, but may eventually be deprecated or removed. @match is preferred because it makes it more clear to users which pages a script will run on.

Early Injection

Chromium's user script support features the ability to run scripts very early in the page's lifecycle. To use early-injection, add the @run-at document-start line to your user script header, like this:

// ==UserScript==
// @name My script
// @description It's really neat
// @match http://www.google.com/*
// @run-at document-start
// ==/UserScript==

Early injected scripts are run after the document element (usually <html>) is created, but before any other elements are parsed.