Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
This is the script I have included in my search-results.htm page along with it
in body section in para tag foll. code. If any string is entered in the search bar, it is not searching the website, but it is searching the google. I want it to search the website first and then google.

HTML
<p style="text-align:justify">
                               <gcse:searchresults-only></gcse:searchresults-only>
                           </p>

HTML
<form  action="http://sysaptechnologies.com/sysap_data_files/search-results.htm">
            	<input value="FORID:11" name="cof" type="hidden"> 
            	<input value="005037316513311643510:bqpsfhldzd4" name="cx" type="hidden">


                    
                    	
                        	<input name="q" id="q" value="Search" onfocus="if(this.value=='Search') {this.value='';}"  önblur="if(this.value=='') {this.value='Search';}" class="bar" type="text">
                        
                        <input value="Search" class="go backcolr" type="submit">
                    
                    </form>>

JavaScript
<script>
  (function() {
    var cx = '005037316513311643510:bqpsfhldzd4';
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
        '//www.google.com/cse/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
</script>
<gcse:search></gcse:search>
Posted
Comments
[no name] 29-Nov-13 20:05pm    
You can implement a google custom search.
rgboss 30-Nov-13 4:55am    
can u help me in solving this problem. It is searching whole web but not that particular site. It should search contents from that site first after that whole web.????
[no name] 30-Nov-13 8:00am    
https://www.google.com/cse/create/new

you can start here.

1 solution

You can create a google custom search to search only the website.

https://www.google.com/cse/create/new[^]

Add the links to the sties you want to search and click on create.

Then on the next page Google will already create a script for you to implement in your site and give an HTML example.
 
Share this answer
 
Comments
rgboss 1-Dec-13 12:34pm    
I have done all that stuff, but still it is not searching the site and instead it is not searching it is showing result as "no results found"
[no name] 1-Dec-13 12:34pm    
can you give me a link to the website?
rgboss 1-Dec-13 12:42pm    
http://sysaptechnologies.com/sysap_data_files/ccna-security.htm
[no name] 1-Dec-13 13:10pm    
aaahhhh in your google custom search you should use the base URL sysaptechnologies.com
[no name] 1-Dec-13 13:11pm    
i must say that if you build that website that is a very good website.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900