23 February 2009
As we all know the Google search engine is the most used search engine.
So what if people could do a Google search direct from your website?
What if this Google search on your website only searched your website?
What if it was really easy to add the Google search to your website?
Silly to say no.
You can go to www.google.com/coop/cse/ or have a look at my code below
<form method="get" action="http://www.google.com/search">
<input type="text" name="q" maxlength="255" value="" />
<input type="submit" value="Google Search" />
<input type="checkbox" name="sitesearch" value="www.peternichol.com" checked /> only search Your own website
Above is the code you need, but you may also want to lay it out a bit differently.
If we place it all inside a box with a 1 pixel border and then line space things correctly the code will look like this
<div style="border:1px #000000 solid; width:280px; padding:7px;">
<form method="get" action="http://www.google.com/search" target="_blank">
<p style="margin:0px;"><input type="text" name="q" maxlength="255" value="" />
<input type="submit" value="Google Search" /><br />
<input type="checkbox" name="sitesearch" value="www.peternichol.com" id="only_this_site" checked /> <font size="small><label for="only_this_site">only search this website</label></font></p>
You can style it differnetly using CSS and you can chose to remove the "Only search this site" part, which will mean it will search the whole of the Internet.
This code will open Google in a new window or tag, and then it will be the normal Google view but with your search results already visible.
Have a try on my example above if you don't believe me!
Please leave a comment using the form provided.