Bookmarklet
Alternatively referred to as favelets, bookmarklets are interactive bookmarks that contain JavaScript code that allows the bookmark or favorite to perform additional features. For example, the popular social networking site Facebook has a share bookmarklet to share any web page you are on with all your friends without having to do it through Facebook or the webpage.
How do I add a bookmarklet?
Each browser has its own method of adding a bookmarklet to your bookmarks or favorites. Below are the steps on how to do this for each of the major browsers. In these examples, you will be adding a Computer Hope Search bookmarklet, which allows you to highlight any text in any web page and click the Bookmarklet to search Computer Hope for that text.
Microsoft Internet Explorer users
- Right-click this example bookmarklet link: Computer Hope Search
- Click Add to Favorites.
- Because a bookmarklet uses JavaScript, you will get a warning. Click Yes to continue.
- If you want change the name and change the "Create in" location to Favorites Bar.
- Click Add.
Mozilla Firefox and Chrome users
- Click and drag this example bookmarklet (Computer Hope Search) to your browsers bookmark bar.
- After letting go the bookmarklet entitled "Computer Hope Search" should be listed.
What is the code for the above Bookmarklet?
Below, is the HTML and JavaScript used for the above bookmarklet. If you want to create a bookmarklet for your own site or another website feel free to modify this code.
<a href="javascript:function se(d) {return d.selection ?
d.selection.createRange().text : d.getSelection()} s = se(document); for
(i=0; i<frames.length && !s; i++) s = se(frames[i].document); if (!s ||
s=='') s = prompt('Computer%20Hope%20search','');
open('http://www.computerhope.com/' + (s ? 'cgi-bin/search.cgi?q=' +
encodeURIComponent(s) : '')).focus();">
Computer Hope Search</a>
Also see: Bookmark, Favorites, JavaScript
