![]() |
Can I add a Microsoft Bing search box to my site?I know that Google is the popular search engine for most folk, but I really think that Microsoft's Bing system is better and offers up more useful results. To help Bing become more successful, I'd like to have a search box on my site that utilizes the Bing search engine. Is that possible? I agree with you that Bing is becoming quite a credible competitor to Google and that the results are show in a useful form, including info that Google just doesn't have. I'm not sure that it'll every overtake the Google behemoth, but then again, just because Ferrari doesn't sell more cars than Ford that doesn't mean it's not a cool car! As with the other search systems I have unwrapped and reverse engineered on the site (including Google, Google Images and YouTube), the first step with figuring out how Bing works with search is to go onto the site itself and run a search, then look at the resultant URL. A Bing search for "cherries" (get it?) produces its results against the URL: http://www.bing.com/search?q=cherry&go=&form=QBLH&qs=n&sk=
Now we can unwrap this by knowing a bit about how method=get Web forms work: action=http://www.bing.com/search q=pattern go= form=QBLH qs=n sk= Based on my experience reverse-engineering other search forms, I am going to start with the most minimal possible search box: <form method=get action="http://www.bing.com/search">
<input type="text" name="q" /> <input type="submit" value="Go!" /> </form> Here's how it looks when we actually include it here on the blog entry: Try it. Type in a search query and click on "Go!" to see what happens. Functional, but a bit boring. Let's make it a tiny bit more attractive by adding a bit of CSS: <form method=get action="http://www.bing.com/search">
<div style="border:1px solid black;padding:5px;width:350"> <center> Search Bing: <input type="text" name="q" size="30" /> <input type="submit" value="Go!" /> </center> </div> </form> Again, when I actually implement it here on the blog entry, this is what we get: So that's your answer. You can tweak and fiddle from here... :-)
Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon
Categorized:
CGI Scripts and Web Site Programming
,
HTML and CSS
(Article 9496)
Tagged: bing, bing search, google, google search, html coding, yahoo Previous: How can I hide "today" search in the Finder sidebar? Next: Review: Apple iPad cases View Mobile Version Subscribe!
Just curious why you use "<div style=...>" to set the style, but then use "<center>" separately. Couldn't that just be part of the div's style? Posted by: Ken B at July 9, 2010 12:09 PMKen, experimentation will reveal what I have always found a huge disappointment and flaw in the CSS positioning attribute: it only centers text containers, not graphical containers. In other words, using <div style="text-align:center;"> will not actually center everything in that DIV tag, so I find that I still use the CENTER tags anyway. If there is another CSS attribute that centers everything in that DIV I would sure love to know about it! Posted by: Dave Taylor at July 9, 2010 1:35 PMHmm... This works for me in Firefox 3.6.6, Safari 5.0, and IE 8.0. (Maybe the CSS specs don't specify that it should "work", but it does, anyway?) <div style="text-align: center;"> I have something to say, now that you mention it, but ...
I do have a comment, now that you mention it!
|
Recommended
Recent Entries
Search
I Need Help!
Apple iPad Help
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 Facebook Help HTML and CSS Industry News and Trade Shows Mac OS X Help MySpace, 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 |