Log in

View Full Version : Search bar in google



Bornfree
06-09-2009, 11:45 PM
Hi Guys,

Just wondering if it's possible to have you sites search box on the results of Google search?

Try to search for dynamic drive in google and the first result has it's won search bar withing dynamic drive!

How can i do this for my website?

X96 Web Design
06-10-2009, 07:15 PM
Here, I copied this off my website:


Here’s the script source code. We’ll explain it all below.

HTML:

<form method="get" action="http://www.google.com/search" onSubmit="mysitesearch(this)">
<input name="q" type="hidden">
<input name="searchterms" type="text" size="25"> <input type="submit" value="Search...">
</form>

JavaScript:

<script type="text/javascript">
//Enter the domain of your site
var domain="www.dynamicdrive.com"
function mysitesearch(curobj){
curobj.q.value="site:"+ domain +" "+curobj.searchterms.value
}
</script>

The Code Explained

Starting with the Javascript, because it’s the hardest part with variables.

The only thing you have to change is the domain variable, shown in red below.

<script type="text/javascript">
//Enter the domain of your site
var domain="www.dynamicdrive.com"
function mysitesearch(curobj){
curobj.q.value="site:"+ domain +" "+curobj.searchterms.value
}
</script>

Simply put in your domain of your site. As an example… X96 Web Design. Here’s how it would look.

<script type="text/javascript">

//Enter the domain of your site
var domain="x96webdesign.uuuq.com"
function mysitesearch(curobj){
curobj.q.value="site:"+ domain +" "+curobj.searchterms.value
}
</script>

You don’t have to put http:// in the front, it doesn’t matter if it’s not there.


Hope this helps,
X96

Snookerman
06-11-2009, 05:37 AM
X96, that's not what the OP is talking about, please read the question carefully before answering in the future.

Bornfree, what you are looking for is called “teleportation (http://googleblog.blogspot.com/2008/03/search-within-site-tale-of.html)” and only Google can decide whether or not a site should have this feature:

This feature will now occur when we detect a high probability that a user wants more refined search results within a specific site. Like the rest of our snippets, the sites that display the site search box are chosen algorithmically based on metrics that measure how useful the search box is to users.
Many websites are critical of this feature since it encourages people to stay on Google for a longer time instead of going to your site and searching there instead, which has an impact on your measurement of visitors. Nevertheless, if you want this feature, the only thing you can do is to make a good website with a lot of information that is useful to many users.

Good luck!

X96 Web Design
06-11-2009, 01:31 PM
Oh, Sorry... I thought he meant the search bar in the forums where it searched DD...

// X96 \\