0
I created a javascript function that searches inside my site with the google search API, however I would like the word I type to appear only something linked to my site, currently it is bringing google results.
Code js:
<script>
(function() {
var cx = 'minhachave';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:')
'//cse.google.com/cse.js?cx=' + cx
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
How to search only within my site?
I put that where in the code? because I tried it here and it didn’t work no, it continues the same way.
– Stand Alone
@Arthurmoraes where your HTML is populated the search data?
– Guilherme Nascimento