Results 1 to 4 of 4

Thread: Search bar in google

  1. #1
    Join Date
    Nov 2006
    Posts
    116
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Search bar in google

    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?

  2. #2
    Join Date
    Feb 2009
    Location
    Victoria, BC, Canada
    Posts
    303
    Thanks
    18
    Thanked 36 Times in 36 Posts

    Default

    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
    Last edited by X96 Web Design; 06-11-2009 at 05:31 AM.
    Alex Blackie, X96 Design
    My Website
    I specialize in: HTML5, CSS3, PHP, Ruby on Rails, MySQL, MongoDB, Linux Server Administration

  3. #3
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    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 and only Google can decide whether or not a site should have this feature:
    Quote Originally Posted by Google
    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!
    Eddy Proca
    I love Dropbox. Get it through my girlfriend's referral link (I reached my limit) and both you and her get 500 MB extra! Thanks and you're welcome!

  4. #4
    Join Date
    Feb 2009
    Location
    Victoria, BC, Canada
    Posts
    303
    Thanks
    18
    Thanked 36 Times in 36 Posts

    Default

    Oh, Sorry... I thought he meant the search bar in the forums where it searched DD...

    // X96 \\
    Alex Blackie, X96 Design
    My Website
    I specialize in: HTML5, CSS3, PHP, Ruby on Rails, MySQL, MongoDB, Linux Server Administration

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •