How to automatically clear a query from Firefox's Search bar

Now this might not be the most important thing ever, but, I think it's very handy! Say you type a search string, e.g. "Threadless t shirt", in Firefox's Search bar, and hit enter. You find what you want and browse for a while, till you need to search again. Now if you're the sort of person who clicks inside the Search bar (like me), then you will have to delete whatever you put in last time before typing a different query. Now life would be a tiny tiny bit easier if that search string would get cleared automatically whenever we did a search!
I thought the answer would be easily found on the Internet, but that wasn't the case. Thankfully the MozillaZine Firefox forums were helpful and soon I found a solution: the Searchbar Autosizer! So what does this extension (addon) do? From the website:-
Does what its name says. It auto expands (resizes) the searchbar if needed, and shrinks it if you don't have anything typed in you'd probably want to read.
Now this is good, but not what we're after... so, there's a little option in the extension's Options Dialogue Box called "Empty searchbar when a query is submitted". This option does all the magic! Remember to click the Advanced button on the first screen to get to this dialogue. Now whenever you type a query and press the Enter key, the string will be deleted, leaving the Search bar fresh and ready for a new search string. But that's not all... Since I installed this extension, I've also grown fond of its main use: auto-sizing the Search bar. I usually don't have a snake trail for a query, but this does come in handy for the times when a lot has been entered. I've set mine up as the figure below, which works great. You can also try the live demo on the extension's website to see how it works.
So we've hit two birds with one stone (so to say!). We can clear the query from the Search bar once we press the Enter keyand change the size automatically depending on the size of the search string. A shortcut guru might say that a simple Ctrl+K (Command+K on mac) would nearly do the same thing, as it automatically highlights the previous search string, ready for it to be cleared. That's an alternative too I guess... but I like my way! :)







Comments
[...] How to automatically clear a query from Firefox’s Search bar [The Authentic Fake] Original post by Lifehacker [...]
I use a bit of JavaScript (along with the userchrome.js extension) to get the job done.
userchrome.js extension: http://forums.mozillazine.org/viewtopic.php?t=397735
Code:
/* :::: Searchbar Autoclear :::: */
(function()
{
var searchbar = BrowserSearch.getSearchBar();
if(searchbar && "handleSearchCommand" in searchbar)
{
eval("searchbar.handleSearchCommand ="+searchbar.handleSearchCommand.toString().replace(
'var textValue = textBox.value;',
'var textValue = textBox.value; setTimeout(function(){ BrowserSearch.getSearchBar().value = ""; }, 1000);'
));
}
}());
Thanks for the top Aaron!
I've found userChrome.css to be very handy, so I think using the userchrome.js extension will give just the right result! (plus other tweaks can be added)
Great tip!
I don't see what the big deal is. When I click anywhere in the search text box, the previously searched phrase becomes highlighted so that it is overwritten by the new item to be searched.
doesnt work
holy christ just use ctrl+k people.
and don't install another bloated extension - if you want to make the search box wider type about:config in the address bar, press enter, scroll down to "browser.urlbar.hideGoButton" and change the value to true. this eliminates the little green arrow that no one uses and widens the box.
@ans
This article is not about making the search box wider, it's about automatically clearing its content when a search is done, so please read the title!
Also, if 30KB is considered bloated by you, you might want to try Searchbar Autosizer Lite (7KB), which you have to set using about:config (seems more like something you'd like).
thanks for the tip. i couldn't find an answer to this anywhere.
Yay! This has always annoyed me. Thank you very much for the tip.
Post new comment