
How do I add a Yahoo search box to my site?How do I add a Yahoo search box on my site? I can see you've written about Google, but Yahoo's impossible to decipher! I agree with you about how complex Yahoo's search code is. In fact, I think that deciphering the Yahoo home page source code could easily be the final exam of a graduate level computer science course. It's really unbelievably baffling! Fortunately you can reverse engineer the search by simply looking at the URL that is produced when you do a Yahoo search, strip out the unnecessary variables, and then build a rudimentary HTML form that produces the remaining. Let me show you... I'll do a Yahoo search for Microsoft Zune and here's the URL that's produced: http://search.yahoo.com/search?p=microsoft+zune&fr=yfp-t-501&toggle=1&cop=mss&ei=UTF-8
Now, within the Web browser's Address box, I'm going to experimentally remove specific name=value pairs to pare it down to the bare minimum. Turns out that the following much simpler URL produces the exact same search result: http://search.yahoo.com/search?p=microsoft+zune
Nice! You can avoid all the other mumbo-jumbo, and thank goodness. The form that produces that search looks like this: <form method="get" action="http://search.yahoo.com/search">
<input type="text" name="p" /> <input type="submit" value="Search Yahoo!" /> </form> That's all there is to it. Here's a Yahoo search box that has exactly that code underneath it: One more tweak, though, just because that search box looks just a wee bit boring! You can drop in some minimal CSS and put a nice little box around the search form: <form method="get" action="http://search.yahoo.com/search"
style="border:3px double black;padding:5px;"> <input type="text" name="p" /> <input type="submit" value="Search Yahoo!" /> </form> Which now looks like this: Hopefully that'll help you out!
Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Simpy.
Categorized:
HTML and CSS
(Article 6960)
Tagged: google, html, yahoo, yahoo search Previous: How do I install a root certificate with Microsoft Entourage? Next: How do I fix my Apple iPod: It's busted? Subscribe!
Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader. Using the above code worked fine but is it possible to have the search results open in a new page or tab(IE7)instead of navigating away from my website Dave, just add "target=_blank" within the FORM tag in the code above and you should have the behavior you seek. Posted by: Dave Taylor at February 11, 2008 3:16 PMHi, I am adapting the code to work with an affiliate programme. Problem is that I need to add other parameters to the URL. Using your yahoo example it would be like I need the end URL to be: http://search.yahoo.com/search?fr=yfp-t-501&p=microsoft+zune I have tried making the action URL http://search.yahoo.com/search?fr=yfp-t-501& But it strips off everything after the ? before adding the search term. Posted by: Liz at February 20, 2008 7:42 AMI have a lot to say, but ...
I do have a comment, now that you mention it!
|
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!
Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.
Articles and Reviews
Auctions and Online Shopping Blogs and RSS Feeds Building Web site traffic Business and Management Cell Phones and Mobile Phones CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above HTML and CSS Mac OS X Help MySpace, Facebook, Twitter and Social Network Help Pay Per Click (PPC) Search Engine Optimization Shell Script Programming Sony PSP, MP3 Players, Etc. The Writing Business Unix and Linux Help Video Game Tips and Help Windows Help
Recent Entries
Join the List!
Book Links
|