Web browsers use URIs for the
href attribute of the
<a> tag and for bookmarks. The URI scheme, such as
ftp:, specifies the protocol and required form for the rest of the string. Browsers also implement a prefix
The executing script has access to the current page, which it may inspect and change. If the script returns an undefined type (rather than, say, a string), the browser will not load a new page, with the result that the script simply runs against the current page content. This permits in-place font size and color changes, for example, without a page reload.
An anonymous function can be used to force the script to return an undefined type:
/* Statements returning a non-undefined type, e.g. assignments */
Bookmarklets are saved and used as normal bookmarks. As such, they are simple "one-click" tools which add functionality to the browser. For example, they can:
- Modify the appearance of a web page within the browser (e.g., change font size, background color, etc.).
- Extract data from a web page (e.g., hyperlinks, images, text, etc.).
- Remove redirects from (e.g. Google) search results, to show the actual target url.
- Submit the current page to a blogging service such as Posterous, link-shortening service such as su.pr, or bookmarking service such as Delicious.
- Query a search engine, with search term(s) provided by previously selected text, or by a dialog box.
- Submit the current page to a link validation service, or translation service.
- Set commonly chosen configuration options when the page itself provides no way to do this.
"Installation of a bookmarklet" is performed by creating a new bookmark, and pasting the code into the URL destination field. Alternatively, if the bookmarklet is presented as a link, under some browsers it can be dragged and dropped onto the bookmark bar. The bookmarklet can then be run by loading the bookmark normally.
They were a deliberate feature in this sense: I invented the
URLs could be used as any other kind of URL, including being bookmark-able.
In particular, I made it possible to generate a new document by loading, e.g.
Full article ▸