Bookmarklet

Updated: 06/16/2017 by Computer Hope

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, 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 web page.

How do I add a bookmarklet?

Computer Hope bookmarkletEach 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, the Computer Hope Search bookmarklet is used for an example. This bookmarklet allows you to search Computer Hope from your browser.

Microsoft Internet Explorer users

  1. Right-click this example bookmarklet link: Computer Hope Search
  2. Click Add to Favorites.
  3. Because a bookmarklet uses JavaScript, you will get a warning. Click Yes to continue.
  4. If you want change the name and change the "Create in" location to Favorites Bar.
  5. Click Add.

Mozilla Firefox and Chrome users

  1. Click and drag this example bookmarklet (Computer Hope Search) to your browser's bookmark bar.
  2. 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 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('https://www.computerhope.com/' + (s ? 'cgi-bin/search.cgi?q=' + encodeURIComponent(s) : '')).focus();">Computer Hope Search</a>

Bookmark, Favorites, JavaScript