Home > Software design >  How can I make search bar searches only my website pages and give suggetions
How can I make search bar searches only my website pages and give suggetions

Time:12-22

How can I make search bar searches only my website pages and give suggetions

CodePudding user response:

Here's the sample HTML and js form code for search bar:

<script type="text/javascript">
document.getElementById('searchform').onsubmit = function() {
    window.location = 'http://www.google.com/search?q=site:yourdomainname '   document.getElementById('test').value;
    return false;
}
</script>

<form id="sarchform"  method="get" action="source.html" />
<input  id="test" type="text" name="search" size="10" maxlength="255"/>

CodePudding user response:

Check the below link, you may get a chance to go next step

https://support.google.com/programmable-search/answer/4513903?hl=en#zippy=,how-do-i-change-the-language-of-the-search-engine

  1. From the google control panel, select the search engine you want to edit.
  2. Click Setup from the menu on the left and then click the Basics tab.
  3. Click Get code.
  4. Copy the code and paste it into your site’s HTML source code where you want your search engine to appear. If you've chosen the two column or two page layout option, you'll need to copy and paste two snippets of code:
  • Paste the first code snippet where you want the search box to appear.
  • Paste the second code snippet where you want the search results to appear.
  • Related