Inject jQuery into Any Webpage
Even MVVM framework is more and more popular in the web front developments, but the strength of jQuery cannot be replaceable. Sometimes, we need the jQuery’s useful APIs to achieve some complex actions, but many webpages give up jQuery, so some skills is needed to inject the jQuery into the webpages which had abandon the jQuery library.
I find a good solution and share it, here is the code:
if(!window.jQuery){
var script = document.createElement('script');
script.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js";
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
}
Just copy the code into the Chrome Devloper tool, and the jQuery would be loaded into the webpage :-)