11 January 2005
| Googlescript Searches |
I read a useful Google hack recently - the following link opens a Javascript window:
Javascript:void(q=prompt('Type%20in%20the%20search%20term:')); if(q)void(location.href='http://www.google.com/search?q='+escape(q))
Click the link and type in your search term. When you click 'OK' it takes you to the Google results page for your search term. What's that you say? Not very inspiring so far? Well, how about this -
Using just a little knowledge of the way Google searches you can search web directories:
Javascript:void(q=prompt('Type%20in%20the%20type%20of%20file%20here:')); if(q)void(location.href='http://www.google.com/search?client=googlet&num=100&q=intitle%3A%22index%20of%20/%22%20%22'+escape(q)+'%22')
Or you can specify a particular file type (in this case I've used .mp3, you can replace it with .ogg or .avi or whatever takes your fancy
):
Javascript:void(q=prompt('Type%20the%20name%20of%20the%20MP3:')); if(q)void(location.href='http://www.google.com/search?client=googlet&num=100&q=intitle%3A%22index%20of%20/%22%20%22'+escape(q)+'%22%20mp3')
Of course, despite the title of this post, this tip isn't restricted to Google - my favorite use of this technique is the search term below which I cobbled together to enable me to quickly search this blog:
Javascript:void(q=prompt('Search%20Digital%20Life%20the%20OS%20X%20way:')); if(q)void(location.href='http://emandtim.no-ip.com/cgi-bin//mt-search.cgi?IncludeBlogs=1&search='+escape(q))
Note that there should be no spaces in the above code snippets.
One great use of this method is to place a button in your Bookmarks bar:

15 December 2004 - Windows evangelist twists truth
8 February 2005 - Googlemaps
5 January 2005 - Security Cameras on Google