Easy Code to Add Bing Site Search to Your Website
By Stephen Bucaro
If your website consists of more than just a few pages, it's important to have
a way for your visitors to search your website. There are several ways you can
accomplish this. One way is to use a pay site search company which will index
your site's contents and provide you code for a search box. This may give you
more control over the results returned for a specific search. But, the down side is,
you have to pay.
Another way to put site search to your website is to create your own index of
your site's contents and write your own search program. This gives you complete
control over the results returned. The down side, it's very complicated to write
code that can create an index and return results from that index based upon
a specific search term or phrase.
Another way is to simply put the code for a search box that calls the search
program of one of the major search providers, like Bing. Bing is Microsoft's
attempt to steal some of that lucrative search traffic from Google. The name
"Bing" comes from the phrase "Because it's not google". Bing is very powerful,
so if you're anti-Google, you may choose to implement a Bing search box.
The down side is that Microsoft is in the search business to make money,
so there will be some not from you're website results returned with your
The code for Bing site search is shown below, just paste this code into the
desired location on your website.
<form method="get" action="http://www.bing.com/search">
<input type="hidden" name="cp" value="1252" ?>
<img src="http://www.microsoft.com/presspass/_resources/images/img_windowsBingLogo.png" alt="Bing" /></a>
<input type="text" name="q" size="30" maxlength="255" />
<input type="submit" value="Search Site" />
<input type="hidden" name="q1" value="site:bucarotechelp.com" />
One thing you'll want to do is replace the text "site:bucarotechelp.com" with
the URL of your website (unless you want to post a form to search my website.
In that case thank you.) And just above that you may want to replace the text
"Search Site" with "Search (the name of your website)". Or just leave it "Search Site".
After you make those modifications, type in a search term or phrase and give
it a test. You can't get the services of a powerful search engine on your website
any easier or cheaper than this.
Note: Some people don't like their visitors being redirected away from their website
to Microsoft's search site. To avoid that, in the top line of the code and add the
target attribute as shown below.
<form method="get" action="http://www.bing.com/search" target="_self">
The target "_self" will cause the contents of your window to be replaced with bing's
results. If you use the target "_blank" instead, a new window will be created and bing's
results will be in that new window.
More HTML Code:
• How to Troubleshoot an HTML Table
• HTML List Basics
• HTML center Tag
• HTML Linking Basics
• Use Meta Tags for Search Engine Optimization
• Checkbox Basics
• Use an Image as a Form Submit Button
• HTML Bulleted or Unordered List
• Webpage DOCTYPE Declarations Explained
• HTML5 Input Type - URL