Skip to content

Instantly share code, notes, and snippets.

@greyaperez
Last active December 9, 2015 15:57
Show Gist options
  • Save greyaperez/5a47628b194b2a17b157 to your computer and use it in GitHub Desktop.
Save greyaperez/5a47628b194b2a17b157 to your computer and use it in GitHub Desktop.
Inject jQuery from Dev Console on any Page
var JS_LIB = {
ANGULAR: 'https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js',
JQUERY: 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js',
LODASH: 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.js'
}
// Inject jQuery & Lodash
function injectAndRun(lib, callback) {
(function(d, script) {
script = d.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.onload = function(){
if (callback) {
callback();
}
};
script.src = lib;
d.getElementsByTagName('head')[0].appendChild(script);
}(document));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment