Last active
August 29, 2015 14:06
-
-
Save reneoelke/09b0fd4087ae78c4b5fa to your computer and use it in GitHub Desktop.
jQuery Bookmarklet for Chrome
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript: | |
| var jQueryVersion = "2.1.1"; | |
| if (typeof(jQuery) == "undefined") { | |
| var jQueryScript = document.createElement('script'); | |
| jQueryScript.type = "text/javascript"; | |
| jQueryScript.src = "//ajax.googleapis.com/ajax/libs/jquery/" + jQueryVersion + "/jquery.min.js"; | |
| jQueryScript.onload = function() { | |
| jQuery.noConflict(); | |
| console.log("jQuery " + jQuery.fn.jquery + " loaded successfully."); | |
| }; | |
| jQueryScript.onerror = function() { | |
| delete jQuery; | |
| console.error("Error while loading jQuery!"); | |
| }; | |
| document.getElementsByTagName('head')[0].appendChild(jQueryScript); | |
| } else { | |
| if (typeof(jQuery) == "function") { | |
| console.info("jQuery (" + jQuery.fn.jquery + ") is already loaded!"); | |
| } else { | |
| console.info("jQuery is already loading..."); | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here are the steps to create this bookmarklet in Chrome:
Ready. Just open the javascript console with Alt + Cmd + j / Alt + Ctrl + j, click on the bookmarklet and have fun (i.e.
jQuery.get();). ;-)