Skip to content

Instantly share code, notes, and snippets.

@SmellyFish
Created April 4, 2014 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SmellyFish/9979004 to your computer and use it in GitHub Desktop.
Save SmellyFish/9979004 to your computer and use it in GitHub Desktop.
Google CSE Examples
<script>
(function() {
var cx = 'your_cx_code_goes_here';
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:searchbox-only></gcse:searchbox-only>
<script>
(function() {
var cx = 'your_cx_code_goes_here';
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:searchresults-only></gcse:searchresults-only>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment