I saw your article about adding an eBay search box to your site – very cool – and would like to find out how I can add a search box for Google’s Froogle shopping service to my page. Ideally, I’d like to have it open up in a new window when someone does a search. Can you help me out?
You’ll want to take the same basic steps that I showed in my article about Adding an eBay search box to your page, but let me step through it directly.
In this case, therefore, I’m going to do something a bit different and reverse engineer the form. Since it’s using a method=”get” (that is, sending its arguments via the URL) it’s easy to do this: Search for something, then look at the resultant URL.
I searched for teapots and here’s the URL of the search results page on Froogle:
We can get everything we need from this URL. Here’s this same information poured into a rudimentary form:
<input type=”text” name=”q” />
<input type=”submit” name=”btnG” value=”Search Froogle” />
Hopefully you can see how the URL became the “action”, the name of the search variable (“q”) became the name of the text input variable, and the submit button was given the name “btnG” and the value of “Froogle Search” so that the resultant query would be in exactly the same form as generated from the Froogle home page?
One small refinement: add target=”_blank” to the form tag and you’ll ensure that the search results appear in a new window.
Let’s test it out: