Favelets are bookmarks which contain JavaScript code. The code is used in many forms either for fun purposes or for reducing routine tasks. In present times, you won’t require favelets much since browser’s have got upgraded to include plugins or come with inbuilt features. But still, if you are stuck with a browser which does not have such features or plugin facilities then favelets can be your saviour.

Favelet

A couple of days ago I was in such a situation. I am addicted to Firefox and already have a lot of plugins which increase my productivity. But in those couple of days, I was left with the dreadful Internet Explorer 6.0. Life became more difficult for me when I found myself opening up the Google homepage every time I wanted to search something. I did not have the rights to download the Google toolbar. But since I knew about Favelets I quickly made some and later found that even getting stuck with IE 6.0 did not matter any more.

How to make a favelet?

Suppose you are in a similar situation as mine and suppose you tend to search more in Google than do any other work. Without Google toolbar you would be just helpless. So I would explain here how to make a simple Google Search Favelet and a word-meaning finder.

Making a Favelet is not a difficult task. For a simple example, copy paste this line directly in your browser’s address bar.

javascript:alert("Hello World");

When you hit enter it would show you the prompt with the message. You can do this in any browser.

Now that the idea is clear lets start with our Google Search favelet. Do the below steps:

  • Create a new bookmark in your browser and name it “Google Search”
  • Put the below code in your bookmark location (the place where you put in the URL):
javascript:var keyword = prompt('Enter Keyword','');if(keyword!=''&keyword!=null)window.open('http://www.google.com/search?hl=en&q=' + keyword + '&btnG=Google+Search&meta=');void 0
  • Remember to make the bookmark toolbar visible from your browsers menu for easier access.
  • Try it out, When you click it , a prompt will appear for keyword entry and on entry it will open a window to show you the results.
  • If you couldn’t make it, click this link or drag and drop the link on your bookmark toolbar.

Meaning Finder

Suppose you are in a habit to find out the meanings of difficult words when you are surfing the web. You would find it distracting to open Google on another window and search the meaning of the word by copy pasting it. Having a favelet which can just catch the highlighted word on the page and then open up Google and automatically do a search on the word would be something you would crave for. Let’s try to extend the above created favelet to make this happen. The two additional things which are required in this case are:

  • Using the Google Trick define:keyword
  • JavaScript function document.getSelection();
  • Create a new Favelet “Define” and put in the below code:
javascript:var keyword = document.getSelection();if(keyword!=''&keyword!=null)window.open('http://www.google.com/search?hl=en&q=define%3A' + keyword + '&btnG=Google+Search');void 0
  • Drag n drop the link to try the favelet. Select some word for which you want the meaning and then click the favelet on your bookmark toolbar.

Points to Ponder

If you are a JavaScript veteran, you can try out many interesting and complex favelets which can reduce many of your tasks. But you have to remember that since JavaScript behaves differently in different browsers, you would have to make the necessary changes in your Favelets in order to make them generic to all browsers.

Many of the social networking site often have a bookmarklet (same as favelets) which help you to bookmark a page into their network. Some examples are:

Some other useful favelets which I have found from the web:

I hope you found this article interesting and if you create any interesting favelet don’t forget to mention it here.


Stumble Digg Technorati Subscribe Delicious