Skip to content

Instantly share code, notes, and snippets.

@rajiteh
Last active August 29, 2015 14:14
Show Gist options
  • Save rajiteh/c5031bfb5d2adb987c6a to your computer and use it in GitHub Desktop.
Save rajiteh/c5031bfb5d2adb987c6a to your computer and use it in GitHub Desktop.
Inject jQuery to any website with this one simple trick!
//Paste this on the console.
//Your jQ code should go in function 'jqExec'
//You can override the version by changing the 'version' parameter.
(function(version) {
if (typeof version == "undefined") { version = "2.1.1"; }
var script = document.createElement("script");
script.src = "https://code.jquery.com/jquery-" + version + ".min.js";
script.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(script);
var interval = setInterval(function() {
if (typeof jQuery === "function") {
clearInterval(interval);
jqExec(jQuery);
}
}, 500);
function jqExec($) {
alert($.fn.jquery);
}
})("1.9.0");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment