This is a mini-article I wrote for the SitePoint Community Crier after a fellow staff member requested that I write some helpful tips for "next week's Crier". It's just been published in Issue 64 and I'm simpy reproducing it here.
The SitePoint Community Crier is the newsletter of SitePoint Forums, and is put together by the Community Team lead by Saara Ord (Saz249). They do amazing work and I must say probably the most work among all the Teams (Programming, Design, Hosting, and Grow) just by producing the Crier alone. If you are not already subscribed, show them a bit of support by giving the Crier a go (subscribe at Newsletters page).
I'll probably be writing more mini-articles for Firefox for the Crier, so if you have any suggestions on what I should cover, do write me or leave a comment. An even better idea would be to submit your own article to the Crier staff for publication - if you're already a member of SitePoint Forums, just contact Saz249, or you can write me and I'll set you up.
Now, on to the article...
Outfox, Outsearch with Firefox
Searching from address bar
Did you know that if you entered a search term into the address bar (where you'd normally enter a URL), Firefox does a "I'm Feeling Lucky" search on Google? If you don't know what that means, try clicking the "I'm Feeling Lucky" search on Google the next time you're there - basically, it takes you to the very first search result.
Granted, not many people would consider that very useful. I'd prefer to have it perform a normal Google search instead, as I'm sure quite a number of you would too. Not to fear, because with Firefox, you have control!
Let's see how you can make Firefox perform a standard Google search from the address bar:
- Type in about:config in your Firefox address bar. It should open a page like this (click for a larger image):
- In the "Filter" textbox, enter "keyword.URL". You should then see the keyword.URL preference with the value "http://www.google.com/search?btnI=I%27m+Feeling+Lucky&q=". This is what makes it perform a "I'm Feeling Lucky" search.
- All we got to do, is to double-click that preference, and enter "http://www.google.com/search?btnG=Google+Search&q=" in the textbox of the dialog that comes up.
- Hit "OK", and you're done! Try it out.
If Google doesn't quite float your boat, you can use other search engines as well. Use "http://search.yahoo.com/search?p=" for a Yahoo! search, "http://imdb.com/find?q=" for a IMDB search, "http://dictionary.reference.com/search?q=" for a Dictionary.com search, and so on. You just have to make sure that the search string of your search facility accepts a query string that takes in your keyword(s).
This is an amazingly powerful feature in Firefox. With custom keywords, you can load up a webpage using with your assigned keyword. For example, I can go to the SitePoint.com website by typing "sp" into the address bar. To achieve that, all I had to do was to create a bookmark for SitePoint.com (http://sitepoint.com/) and add the keyword "sp".
"That's it?", you say. Well, we're getting to it, the real power of custom keywords, that is. With custom keywords, I can Google search for the "best browser" by typing "g best browser" in the address bar, lookup the meaning of "promissory" on Dictionary.com by typing "d promissory", and lookup the Bugzilla bug report for bug 75138 by typing "bug 75138". Let's work through how to do that with a Dictionary.com custom keyword search.
- Bookmark "http://dictionary.reference.com/search?q=%s". "%s" is the placeholder that will be replaced by the word (or words) whose meaning you're looking up.
- Give the bookmark a keyword as described above. I use "d".
- Your bookmark properties should then look like this:
- Click "OK" and now typing "d estoppel" in the address bar will load the Dictionary.com entry for "estoppel".
Ben Goodger has also created a Firefox extension called SmartSearch that adds a Smart Keyword menu in the context menu.
Context menu search
Another convenient feature that boosts your search productivity - searching from the right-click context menu. Select the words you want to search, right-click, then select Search Web for "keyword". This will perform a search for your keyword on Google.
Don't like Google? Go to about:config in your Firefox address bar as described in the "Searching from address bar" section and look for the browser.search.defaulturl preference (its value should be "http://www.google.com/search?lr=&ie=UTF-8&oe=UTF-8&q="). You know what to do! (Hint: read the "Searching from address bar" section.)
Find as you type
Now that you've got some search results, you may want to search for occurences of your keyword in a long page. The "Find as you type" function is your savior. Just start typing the word (or words) that you want to find. Firefox will incrementally find and highlight the first instance of the word that matches what you type.
Use F3 or Ctrl-G to do a "Find next". No need to use the mouse, no need for an extra "Find" dialog that gets in the way! This is one of my favorite Firefox features (this is also in Opera) and I often lapse into simply typing to search for stuff in the occasions when I have to use IE!
Change the width of the search bar
The default search bar width is rather small, probably big enough for 20 characters. You can fix this if it bothers you by changing the width by editing your userChrome.css. The userChrome.css file is located in the "chrome" directory in your profile directory. The Firefox Help site has a page explaining how to get to your userChrome.css, if you're not familiar with where your profile folder is. Once you have your userChrome.css, put this bit in there to set the width of the search bar to 350 pixels:
-moz-box-flex: 350 !important;
Upcoming search improvements in Firefox 0.9
Firefox 0.9 will come with more features that will improve your search productivity. You'll be able to drag a bit of selected text into the search bar and perform a search on that text. Firefox 0.9 will also include an auto-complete delete feature where your autocomplete entries can be removed by doing a Shift-delete. Very useful for deleting something you don't want someone else to come across, without having to clear out your entire history ;)
Another recently added feature is the ability to add smart keywords from form fields. No more messing around with "%s" thingies and what not!
These features have been available in nightly builds for quite some time now, so grab yourself a copy if you want them now. The Burning Edge maintains a watchlist of major bugfixes and regressions, and also links to custom builds (which are professionally packaged and come with processor-specific optimizations).