Write your first javascript bookmarklet

Bookmarklet are a funny thing. The oldest I could find are fromĀ Bookmarklet.com and where creatting from simple stuff like date/time to advanced navigation feature.

Basically a bookmarklet is a snippet of code you insert into a bookmark which make it available anywhere. Lets have a look at a very simple example:

Create a link and write in the href attribute this line:

javascript:alert(‘Hello world’);

Say Hi!

Now drag the link to your bookmark or right click>bookmark it. Go on any web page and click on your just created bookmark. You should get an alert window saying “Hello world”. This is of course a very basic example but with the power of javascript you can easyly manipulate the DOM and create new element on a page or delete some, change the color, font size and many more.

This is a very complex bookmarklet that allow you display design tools on a page: Design Bookmarklet

One Response to “Write your first javascript bookmarklet”

  1. UTF-8 special char bookmarklet, twitter Keys reloaded | Your Site is Valid Blog

    [...] About « Write your first javascript bookmarklet [...]

Leave a reply