|
|
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! Also check out:
Categorized:
HTML, JavaScript and Web Site Programming
(Article 6960,
Written by Dave Taylor)
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? Reader Comments To Date: 6Dave Taylor said, on February 11, 2008 3:16 PM:
Dave, just add "target=_blank" within the FORM tag in the code above and you should have the behavior you seek. Liz said, on February 20, 2008 7:42 AM:
Hi, 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. Raja said, on December 8, 2009 8:03 AM:
Hi.... I have developing a website using PHP. I want to integrate yahoo search into my website. I trying this code. The answer is display in new page. I want to display result in my page only. Is it possible? Raja Dave Taylor said, on December 8, 2009 8:29 AM:
Raja, no that's not possible, at least not easily. The easiest possibility would be to use an iframe for the search and search results, but you can't have a small search window and a large search results window. More complicated would be for you to write some software that would submit the search, get the results, and then embed the results in a page of your own. Complicated. alis said, on February 19, 2011 12:10 AM:
pls sir add my site yahoo search engine
I do have a comment, now that you mention it! |
Recent Entries
Search
Recommended
All Our Categories
Apple iPad Help
Articles and Reviews Auctions and Online Shopping Blogs and Blogging Building Web Site Traffic Business and Management Computer and Internet Basics d) None of the Above Facebook Help Google Gmail Help Google Plus Help HTML, JavaScript and Web Site Programming Industry News and Trade Shows iPhone and Cell Phone Help iPod, Sony PSP and MP3 Player Help Kindle Fire Help Mac OS X Help Pay Per Click (PPC) Advertising Pinterest Help Search Engine Optimization (SEO) Shell Script Programming Tech Support Video Help The Writing Business Twitter, LinkedIn and Social Network Help Unix and Linux Help Video Game Tips and Help Windows PC Help ADT on G+ |
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
Thank's
Dave