Have you tried to customize the Google CSE search box to fit your website theme, and having difficulty implementing it? You're not alone. I've browsed Google CSE documentation for some time, but this information is buried under the hood, and took me a while to figure this out. This is a 2-page Search & Results page design. You'll style the form element however you wish to design.

Search Box





<form id="cse-search-box" class="search" title="CSE Search" 
    action="/search-results.html">
<input type="text" name="q" size="" />
<input type="submit" name="sa" value="go" />
</form>

Search Results: Get this code from your CSE control panel.

<script>
(function() {
var cx = '012345678901234567890abcdefghijkl';
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 linktarget="_self"></gcse:searchresults-only>

Share this post

Comments (0)

    No comment

Leave a comment

All comments are moderated. Spammy and bot submitted comments are deleted. Please submit the comments that are helpful to others, and we'll approve your comments. A comment that includes outbound link will only be approved if the content is relevant to the topic, and has some value to our readers.


Login To Post Comment