Thursday, April 29, 2010

[How To] Tweak the default web browser's address bar search !

Posted on 12:51 AM by SlipKoRnSaad

it is possible to make the default web browser's address bar search use more than just google, a la Opera or (I'm told) Firefox.

What to do:

Download this file to your N900, prefereably to the Documents folder.

In XTerminal enter the command

Code:
mv MyDocs/.documents/search.txt search.htm
(NB If you saved to a folder other than Documents from the webbrowser MyDocs/.documents will need to be changed to the requisite path)

In the web browser go to the page about:config

Read the "Here be dragons" warning and promise to be careful.

Find the setting keyword.URL by typing key into the filter box at the top of the page. Select the line keyboard.URL by tapping it and press enter.

Put
Code:
file:///home/user/search.htm?
in the dialogue box that appears and tap Done.

Now when you type a search into the address bar you can choose the following search engines by prefixing them with the letters lited below:

go - regular Google search (not mobile!)

wiki - wikipedia

map - Google Maps UK

ebay - eBay UK

php - PHP manual

mysql - MySQL manual

acronym - acronymfinder.com

urban - urbandictionary.com

(eg ebay n900 in the address bar will seach ebay.co.uk for an N900, wheras wiki n900 will search wikpedia)

You can add to or edit the choice of engines by editing search.htm - I would advise using pygtkeditor, which I think any serious modder should have installed unless they like vim or emacs. I, for instance, have edited the line
Code:
urls['go']='http://www.google.com/search?q=%s';
to read
Code:
urls['g']='http://www.google.co.uk/search?q=%s';
which means that instead of typing
Code:
go foo
into the address bar to get a search for foo from the full-fat google.com I type
Code:
g foo
to search google.co.uk.

A further change I have made is to add the lines
Code:
urls['tt']='http://traintimes.org.uk/%s';
into the search engine list block of code and
Code:

redirUrl = redirUrl.replace(/%2F/g,"\/");
before the line
Code:
document.location.replace(redirUrl);
This allows you to replicate the bookmarkable search function for UK train journeys on the excellent traintimes.org.uk by typing, for instance

Code:
tt hitchin/york/1000/tomorrow
to search for tomorrow's departures from Hitchin to York at around 1000.

The second line of code needs to be added as else between the script and the browser / is replaced with %2F which confuses the website. For more on how to use this look at the traintimes.org.uk frontpage; you can click the iCal links from its search results to get the times entered into your n900 calendar.

Hat-tips to evad for coming up with the idea and Viqsi for the device-side rather than online evolution of the idea in this thread.

Via : talk.maemo.org

No Response to "[How To] Tweak the default web browser's address bar search !"

Leave A Reply