Skip to content

Instantly share code, notes, and snippets.

@chaddotson
Last active September 7, 2015 01:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chaddotson/5199c2da38d34335041a to your computer and use it in GitHub Desktop.
Save chaddotson/5199c2da38d34335041a to your computer and use it in GitHub Desktop.
Copy and paste in the console of a page without jquery to load jquery. Leaves no artifacts of itself once it executes.
// loading jQuery on a site that doesn't have jquery for fun and ... hmmm profit?.
(function (jQueryURL) {
function loadSuccess() {
eval(this.responseText);
console.log("jQuery loaded.");
}
function loadFailed(event) {
console.log("Failed to load jQuery source.", event);
}
if(window.jQuery) {
console.log("jQuery " + $.fn.jquery + " already loaded.");
return;
}
var request = new XMLHttpRequest();
request.addEventListener("load", loadSuccess, false);
request.addEventListener("error", loadFailed, false);
request.open("GET", jQueryURL, true);
request.send();
})("https://code.jquery.com/jquery-2.1.4.js");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment