[Greasemonkey] Getting script to run once the page fully loads
Jeremy Dunck
jdunck at gmail.com
Fri May 19 16:32:46 EDT 2006
On 5/19/06, Vectorspace <vectorspace at ntlworld.com> wrote:
> Greasemonkey only runs scripts when the page has loaded anyway
>
Actually, user scripts inject just before the load event-- on the
firefox-specific DOMContentLoaded event.
chrome/browser.js:
GM_BrowserUI.chromeLoad = function(e) {
...
GM_listen(this.appContent, "DOMContentLoaded", GM_hitch(this, "contentLoad"));
...
}
GM_BrowserUI.contentLoad = function(e) {
...
if (GM_getEnabled() && GM_isGreasemonkeyable(href)) {
..
this.gmSvc.domContentLoaded({ wrappedJSObject: unsafeWin });
...
}
components/greasemonkey.js:
domContentLoaded: function(wrappedWindow) {
...
this.injectScripts(scripts, href, unsafeWin);
More information about the Greasemonkey
mailing list