Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Blank jQuery Bookmarklet
(function(){
if(window.myBookmarklet!==undefined){myBookmarklet();}else{
// the minimum version of jQuery we want
var v = "1.71";
// check prior inclusion and version
if (window.jQuery === undefined || window.jQuery.fn.jquery < v) {
var done = false;
var script = document.createElement("script");
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/" + v + "/jquery.min.js";
script.onload = script.onreadystatechange = function(){
if (!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")) {
done = true;
initMyBookmarklet();
}
};
document.getElementsByTagName("head")[0].appendChild(script);
} else {
initMyBookmarklet();
}
function initMyBookmarklet() {
(window.myBookmarklet = function() {
// your JavaScript code goes here!
})();
}
}
})();
@adrienne

This comment has been minimized.

Copy link
Owner Author

@adrienne adrienne commented Mar 8, 2012

Make sure to change "myBookmarklet" and "initMyBookmarklet" to something less predictable!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.