David Stone's Blog

I'm open to suggestions for a subtitle here! (Really!)


Paul asked if one could easily add jQuery to pages everywhere. He mentioned that you might be able to do it using GreaseMonkey. The answer is: of course you can. :)

var theScript = document.createElement("script");
theScript.src = "http://jquery.com/src/latest.js";
theScript.language = "javascript";
document.body.insertBefore(theScript, document.body.firstChild); 

This is basically the same trick Josh and I use in CPhog. You use the user.js file to inject JavaScript into the page itself, so that rather than running in the GreaseMonkey sandbox, the script is running in the page. You can even use Firebug to run jQuery statements against pages now. Pretty spiffy, eh? 


grand-gambler.com said:

Somewhere I have seen ... And if on that thanks.

# April 1, 2010 6:42 AM

digital prints 8x4 said:

Yong-min and his ears solved to inhabit going in the temperatures.

# May 20, 2010 12:57 AM

weblogs.asp.net said:

JQueryMonkey.. Nifty :)

# May 30, 2011 10:42 AM