Your First Bookmarklet

Okay, Script 17.1 isn’t the most thrilling script you’ll ever see. It’s a variation on our old friend, the “Hello World” script. But what’s important is that you’re getting something to happen in a Web browser without ever loading a Web page. This example also demonstrates how to create and use a bookmarklet in the various browsers.

To create a bookmarklet (Firefox 2):

1.
From the Bookmarks menu, choose Manage Bookmarks. The Bookmarks Manager opens.
2.
From the File menu, choose New Bookmark. The Bookmark Properties dialog opens (Figure 17.1).
Figure 17.1. Firefox 2 (for Windows, in this case, but the Mac version is similar) allows you to enter bookmarklets in the Bookmarks Manager.
3.
In the Name ...

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.