Thu
20
May '10
|
by Frank Spychalski filed under google
No Comments »
|
I love Chrome! But one thing drove me crazy: we have numerous internal web-apps running on different hosts. From Firefox was easy to get to these tools by just typing the toolname (not the FQDN) in the url bar. Chrome knows it better and assumes that I want to search for toolname. A moment later it asked me if I meant toolname/ and remebers this choice (at least it annoys me only once per tool).
Yesterday I I got an idea and tryed a snippet of javascript as a search engine and was happy to see that it worked as intended. A few minutes of javascript hacking later the omnibar behaved the way I like it:
- multiple words are a search query
- single words are URLs, even without the trailing slash, always!
- fix broken http at the start of an URL (happens to me sometimes when I cut’n'paste)
This is the current version of my default search engine, feel free to criticize, I’m a JS noob:
javascript:query="%s"; if (query.search(/\s/) != -1) { window.location="http://www.google.com/search?q=" + query; } else { query = query.replace(/^h?t?t?p?:///, ""); window.location="http://"+query; }
Enjoy and let me know if you have other ideas on how to improve this!