Adding a new script file to a page using GreaseMonkey
My employer is blocking the Google CDN domain that provides the jQuery file to so many websites:
http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js
I want to use GreaseMonkey to provide that jQuery reference fro开发者_开发百科m a different domain. Is this possible? Can I use a GreaseMonkey script to tell a page to load it's jQuery reference from this URL instead?:
http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js
You could have GreaseMonkey add it's own javascript reference, but the problem will likely be that your jQuery code will have already run before jQuery is loaded. Is it possible to call the jQuery code after your GreaseMonkey script loads jQuery again? It seems that you'd have to restart execution of the jQuery code on the page in order for this to get the results you're looking for.
Greasemonkey acts when the DOM has already loaded. You can try to rewrite the code before it gets rendered with a full fledged browser extension. Look into LiveHttpHeaders. I think it may be useful because it intercepts the page before getting to the browser. Based on that, you can then rewrite the source to suit your needs
精彩评论