Industry guru Dave Taylor answers free tech support questions about a wide variety of business and technical topics, including blogging, Google AdSense, MySpace, Sony PSP, Apple iPod, Mp3 players, management, Linux, SEO, Mac OS X, Facebook, Twitter, LinkedIn and Microsoft Windows.

How can I add a Froogle search box to my site?

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?


Dave's Answer:

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.

First step is to go to the page that has the search box you want, view the source code and try to isolate exactly what section of code powers the search box itself. That's usually pretty easy as it's wrapped with <form> and </form>. When I did that on the Froogle page, however, it turns out that the HTML is full of JavaScript, CSS and other stuff that's rather a huge distraction.

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:

http://froogle.google.com/froogle?q=teapots&btnG=Search+Froogle

We can get everything we need from this URL. Here's this same information poured into a rudimentary form:

<form method="get" action="http://froogle.google.com/froogle">
<input type="text" name="q" />
<input type="submit" name="btnG" value="Search Froogle" />
</form>

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:

Nice! Now, a few refinements to make it look a bit better, yes?

What would you like to buy today?

Here's what I did:

<form method="get" action="http://froogle.google.com/froogle"
  target="_blank"
  style="border:1px solid #669;padding:4px;background-color:#cfc;
    width:350px;font-weight:bold;text-align:center;">
What would you like to buy today?
<input type="text" name="q" />
<input type="submit" name="btnG" value="Search Froogle" />
</form>

Hope that gets you going with Froogle!



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Simpy.

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments

Ive been searching and searching. I see "how to make google search my site" and I see "how to add a froogle search" but I dont see "how to make froogle search my site". Google and Froogle seem to do things different so editing one to work with the other doesnt seem to do it.

Posted by: Gandalf Parker at September 8, 2006 11:56 AM

Hi Dave,

I hope it's OK with you, I just tweaked your froogle search box code to create a google images search box. I've been looking everywhere for help with this and am endlessly greatful to you for your brilliant and clear information! Not only do I now have a google images search box, but I also understand how it works :-)

Thanks again,
Ellie

Posted by: Ellie at May 9, 2007 5:19 AM

I have a lot to say, but ...
Starbucks coffee cup I have a lot to say, and questions of my own for that matter, but most of all I'd like to say thank you for all your efforts on this Web site by buying you a chai!

I do have a comment, now that you mention it!









Remember personal info?


Please note that I will never send you any unsolicited commercial email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.


Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Join the List!
Join my author info mailing list, where you'll learn about my upcoming books, speaking gigs, and more!


Book Links
© 2002 - 2008 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]