[Greasemonkey] How to specify script injection time

Lenny Domnitser ldrhcp at gmail.com
Sat Jul 16 00:54:06 EDT 2005


A much-requested feature of Greasemonkey is to inject scripts before
page load. Changing to this behavior would break most current scripts.
Since this functionality will probably come eventually, this should
probably be taken care of ASAP.

Probably, this would require a rule in the metadata block, such as this:

// ==UserScript==
// @inject domload
// ==/UserScript==

for the current behavior,

// @inject download

for operations on the text (not sure if this is possible).

The specific rules can be chosen as the fuctionality is added, but I
would like to discuss the way to actually specify when to inject.
Maybe there is a better way involving GM_* functions or such. This can
be similar to Opera's approach, but only if it is specified in the
metadata comments that these GM_* functions are supported.

So, any votes, tweaks, or ideas to make a smooth transition without
breaking old scripts?


More information about the Greasemonkey mailing list