The Chromium Projects

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.

The Chromium OS designs and code are preliminary. Expect them to evolve.
For Developers‎ > ‎Design Documents‎ > ‎

User Scripts

Current Chromium and Google Chrome dev builds have built-in support for Greasemonkey-style user scripts.

To use:
Known issues:
  • Chromium does not support @require, @resource, unsafeWindow, GM_registerMenuCommand, GM_setValue, or GM_getValue.
  • GM_xmlhttpRequest is same-origin only.

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 @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.