SiteExperts.com Logo Home | Community | Developer's Paradise | Jobs
User Groups | Site Tools | Site Information | Search

Inside Technique : Bookmarklets Introduction
By Scott Isaacs

Bookmarklets are small scripts that are contained within a link. These links can be added to your toolbar to extend your browsing experience. In this article we show you how to create three bookmarklets that add new lookup features to your browser.

Bookmarklets are built using the special javascript: protocol. The javascript: protocol is supported by Microsoft and Netscape and allows you to execute simple scripts on the client through a URL. For example, we use the javascript: protocol in the following link to display an alert: Click Me. The HTML for this link is as follows:

<A HREF="javascript:void(alert('Hello World'))">Click Me</A>

The above link becomes a bookmarklet when you add it to your favorites or add it to your toolbar (you can drag links onto your toolbar in many browsers). Now every time this link is chosen from your favorite menu you get the alert.

Bookmarklets become much more powerful when they are designed to integrate with your browsing experience. The javascript: protocol can execute any simple script. When run as a bookmarklet, the script is run within the context of the loaded document. If your bookmarklet references the document object, it is referencing the document object of the loaded window. This allows you to use bookmarklets to add real value to the browser.

Bookmarklet are also fully cross-browser and cross-platform compatible and are only limited by the script your create. Our bookmarklets on the next page rely on accessing the user's selection so they only run in Internet Explorer 4.0 (non-Mac) and Netscape Navigator 4.0 and later.

Next we show you how to create three simple bookmarklets that can help you improve your vocabulary.

Page 1:Bookmarklets Introduction
Page 2:3 Lookup Bookmarklets