Bookmarklets

What is a bookmarklet and how is it defined?

What is a bookmarklet and how is it defined? Simply, a bookmarklet is a client-side script (usually JavaScript) which is stored as a favorite or "bookmark" in the web browser. It's different than a regular bookmark in that when you click it, instead of going to a page, it runs the script on the page currently in the browser. How is that useful? Well, consider one scenario. A page is downloaded from a remote server and you want to collect information from it for cataloging purposes. For example, a you want a ticket number from one place, a name from another, and a target date from yet another... a bookmarklet can be written to collect these with one click and present them for easy clipboard access. Another scenario is to fill out forms using a collection of credentials for test purposes. Basically anything that you can do manually you can use a bookmarklet to help automate the process.

How to create a Bookmarklet

To create a bookmarklet, use the following steps.
  1. Write the script
  2. Remove all of the line feeds, the final script needs to fit on one line.
    Note: This means you'll need to use semi-colons to end each statement--if you are normally in the habit of leaving them off and using line breaks to differentiate statements.
  3. You need to preface your script with "javascript:" because the script will ultimately behave like the href property of an anchor tag.
  4. You need to terminate your script with void(0); Doing so prevents the href from redirecting the browser to a blank page after your script executes.
That's basically it. Depending on how complicated your script is going to be, you may need to futz around a bit to get it to run without compile errors. Using the javascript error console can be super useful during the dev process.

Specific Bookmarklets

To add one (or more) of these to your browser, right-click on the link you want from the list below and choose "Bookmark this list" (or add to favorites... depending on which browser is imposing it's terminology on you).

Once it's added, to test it, visit a/the page it was designed to operate for, and click the link. Did it work? (If so, well, then, it worked! Good job!) Note: Most of these provide an obvious visual manifestation of when it works--so you should know pretty quickly.