Thursday, December 13, 2007

 

jQuery and Greasemonkey

Now that Fiddler stopped working for me I used Greasemonkey to modify pages on the fly to test some new functionality.

It took me a while to figure out why a global variable which one of the dynamically added scripts created was not visible to my Greasemonkey script. Of course the answer was right there in the Greasemonkey documentation: "As of Greasemonkey 0.6.4, however, user scripts now have their own JavaScript context and execute completely separately from the content document." Fortunately, the document window is also accessible as unsafeWindow, and sure enough that worked.

PS. Michael Baierl pointed out a sample Greasemonkey script to load jQuery before executing functions that depend on jQuery—nice!

Labels: ,

Comments: Post a Comment

Subscribe to Post Comments [Atom]










Page tools



Archives