javascript - Calling Google Custom Search overlay from text link -


i'm using newish style of google custom search overlays search results on current page.

the code below creates search box calls overlay. i'm wondering if there's anyway create text link launch results of overlay of our articles have line "you can search more references on [person] on our site." older 2 page cse ethod allowed call results page /search.shtml?q=person

<script> (function() {     var cx = 'mycseidnumber'; 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> 

i created text link this: /currentpage?cx=mycseidnumber&amp;q=$mysearchterms

clicking on link doesn't create results overlay. if copy link , re-enter in browser pop overlay.

i've searched google cse site , forums can't seem find anything. insight.

you don't need cx param in url, q param. however, need element present in link target page overlay show up. element render both overlay , search box, can hide searchbox css, e.g.:

.gsc-search-box {     display:none; } 

here's example (although jsfiddle not render css you, need add on page separately):

http://jsfiddle.net/rdhs4/3/


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -