Bookmarklet
From Free net encyclopedia
A bookmarklet is a small JavaScript program that can be stored as a URL within a bookmark in most popular web browsers, or within hyperlinks on a web page. Because Internet Explorer uses the term favorites instead of bookmarks, bookmarklets are also less commonly called favlets or favelets.
Bookmarklets can be saved and used like normal web page bookmarks. Therefore, they are simple "one-click" tools that can add substantial functionality to the browser. For example, they can:
- Modify the way a web page is displayed within the browser (i.e., change the font size, background color, etc.).
- Extract data from a web page (i.e., hyperlinks, images, text, etc.).
- Jump directly to a search engine, with the search term(s) input either from a new dialog box, or from a selection already made on a web page.
- Submit the page to a validation service.
Contents |
Examples
The following lines, when joined together to form a bookmarklet, will search Wikipedia for the string currently highlighted in the browser, or else, if nothing is selected, it will display a dialog box form field in which to enter a search string. This bookmarklet works in Firefox and Konqueror (Minitools):
javascript:(function(){q=document.getSelection();if(!q)q=prompt('Wikipedia:'); if(q)location.href='http://en.wikipedia.org/w/wiki.phtml?search='+escape(q);})()
This version works in Apple's Safari browser:
javascript:void(q=prompt('Wikipedia:',getSelection())); if(q)void(location.href='http://en.wikipedia.org/w/wiki.phtml?search='+escape(q))
This version works in Internet Explorer:
javascript:(function(){q=document.selection.createRange().text;if(!q)q=prompt('Wikipedia:',''); if(q)location.href='http://en.wikipedia.org/w/wiki.phtml?search='+escape(q);})()
To install the previous bookmarklet in Internet Explorer, follow these steps:
- Make sure the Links toolbar is visible (ensure View/Toolbars/Links is checked).
- In the Favorites menu, select Add to Favorties...
- Type "Wikipedia" in the Name field.
- In the Create In box, select the Links folder. Click OK.
- Copy the text of the bookmarket, above.
- Right-click on the new "Wikipedia" link in the Links bar, and select Properties.
- Paste the bookmarklet text into the URL field. Click OK.
The next example will set the right margin to 45% to make Wikipedia more readable:
javascript:(function(){var newSS, styles='body { margin-left:0%; margin-right:45%;}';if(document.createStyleSheet) {document.createStyleSheet(%22javascript:'%22+styles+%22'%22); } else { newSS=document.createElement('link'); newSS.rel='stylesheet'; newSS.href='data:text/css,'+escape(styles); document.getElementsByTagName(%22head%22)[0].appendChild(newSS); } })()
History
Steve Kangas of www.bookmarklets.com coined the term "bookmarklet," which he started to create based on an idea suggested in the Netscape JavaScript Guide.
The term favelet was invented by Tantek Çelik on 6 September 2001 (personal email).
Brendan Eich, who developed JavaScript at Netscape, gave this account of his invention of the javascript:
URL (which makes bookmarklets possible):
See also
- Greasemonkey enables functionality similar to that offered by bookmarklets - with one substantial addition - "bookmarklets" can be automatically loaded when a given website is loaded. In Greasemonkey terminology, these scripts that execute when a matching URL is loaded are called "User Scripts". Mark Pilgrim's DiveIntoGreaseMonkey.org[1] is a free book about Greasemonkey.
- Blummy is a kind of drop down menu that can be used to manage one's bookmarklets. Displays as a drop down menu in the current page.
External links
- Slayeroffice.com Favlet Suite: by S.G. Chipman. Favlets for the web designer including Mouseover DOM Inspector, Color List, and HTML Attribute Viewer.
- Jesse's Bookmarklets Site: by Jesse Ruderman. Contains various bookmarklets for different categories.
- Favelets (by Tantek Çelik): Bookmarklets for a variety of, developer oriented, uses.
- Subsimple Bookmarklets: Bookmarklets for navigation, searches, and removing annoyances, among other things. Explains how to write your own bookmarklets and has a Bookmarklet Builder for easy editing.
- Philburns Bookmarklets: Contains bookmarklets on categories like Navigation, Searching, Checking Code Validity etc. Targeted at the Opera browser.
- Samrod's Functional Bookmarks: Bookmarklets for all kinds of search engines, online services, and some powerful web development tools.
- milov: Bookmarklets for web designers.
- Favlets.com: A collection of useful bookmarklets, presented as a blog, with each bookmarklet as en entry allowing user comments.
- Accessibility-checking favelets: Bookmarklets for web designers.
- Andy Budd: Bookmarklets targeted at the Safari browser.
- Svenska "bookmarklets": A few search bookmarklets in Swedish.
- Bookmarklets @ Wisdombay: A place which posts bookmarklets on a daily basis.
- Blummy: Kind-of bookmarklet manager, integrates with a page and displays several bookmarklets.
- Bookmarklet Generator: Automatically create "search" bookmarklets for any website with a search feature
- The LibraryLookup Project: Automatically create a bookmarklet to look up books in your local library that you find on a bookseller's site (e.g. Amazon.com).de:Bookmarklet
es:Bookmarklet fr:Bookmarklet it:Bookmarklet nl:Bookmarklet ja:ブックマークレット pl:Skryptozakładka pt:Bookmarklet ru:Закладурки