Skip to content

Instantly share code, notes, and snippets.

@ggirou
Last active August 29, 2015 13:57
Show Gist options
  • Save ggirou/9408803 to your computer and use it in GitHub Desktop.
Save ggirou/9408803 to your computer and use it in GitHub Desktop.
Easy bookmarklet
include('https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js');
window.alert('Yeah!!!');
@ggirou
Copy link
Author

ggirou commented Mar 7, 2014

Getting started

  • Create a bookmarklet with the following link content:

    javascript:(function(){
    var include = function(url) { var r = new XMLHttpRequest(); r.open("GET", url, false); r.send(); return eval(r.responseText); };
    include('https://gist.githubusercontent.com/ggirou/9408803/raw/easy_bookmarklet.js');
    })();
  • Click on it, you should see "Yeah!!!".

Customize your bookmarklet

  • Change the url value to your own script hosted on Gist or anywhere else.

    var url='http://you.com/path/to/your/script.js';

Limits

  • Some websites specify Content-Security-Policy, so you can't use your bookmarklet (e.g. GitHub).
  • You have to set an https address to be able to use it on secured websites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment