Google Search Focus : Greasemonkey UserScripts

One thing about Google search that irritates me is that the search input box don't have accesskey attribute. Once I do a search, the only way to focus the search input field is to grab the mouse - and I hate that. This script only works on google search result pages(SERPs). If you press 'Alt+s' in a result page, the search text input field will be focused. Very useful if you want to refine your search.

Install Script

Google Search Focus

To install, you must have the greasemonkey extension for firefox browser. If you have it, click the link and choose "Install".

Comments

sangprabo at 20 Mar, 2008 12:02
Hi, I found this script is very useful.
If you don't mind, I will write it as a post in my weblog. Thank you.
Reply to this.
Anonymous at 05 Aug, 2009 04:32
Hey, great script!

I changed a couple of things though:
1. I changed the key combination to Alt+l, so now I can type it more comfortably.. also useful since Ctrl+l highlights the url bar.
2. As it stands, the script gives focus to the search bar, and you append to the previous term... I added 'search.select();' so that it highlights the whole thing.

Good work, very useful.
Reply to this.
Anonymous at 05 Aug, 2009 04:34
I forgot to mention, if you include search.select(); you don't need search.focus();
Reply to this.
Anonymous at 28 Jan, 2010 07:51
Hi,

Great script! I took the part I needed, i.e. this two-liner, to get focus on the search input always;
var search = document.getElementsByName("q")[0];
search.focus();

Cheers,
Olle
Reply to this.
Anonymous at 28 Jan, 2010 07:53
By the way, you may want to change this
// @include http://google.co*/*q=*
// @include http://www.google.co*/*q=*

to this
// @include http://google.*/*q=*
// @include http://www.google.*/*q=*

to make the script work for other domains, like country specific ones.
Reply to this.
Comment

Please dont enter you comments in this form - this is a fake form to confuse spamming bots. The next form is the real one.




Comment




Comment Formating : HTML tags a, strong, em, b, i, code, pre, p and br allowed. Other tags will be shown as code(< will become &lt;). Urls, Line breaks will be auto-formated.