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==
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.
评论