html - On button click load google's first result based on search input the user has given -


so it's hard write proper title, best explain.

the thing i'm looking for, simple way directly load top link google present's if google term.

imagine -> user gives input "bmw x5" in text box , clicks on "submit".

as result have iframe on webpage have it's source set url top result in google.com .

to make clear iframe not load google.com search parameters "bmx x5" instead directly load top listed page.

is possible?

have @ code:

https://productforums.google.com/forum/#!topic/customsearch/iyv7_wswlqk

you need copy page of own , target iframe - possible google not allow that.

if case, need have proxy on server parses search result , redirects first link

<table width="100%" border="0" cellspacing="0" cellpadding="0">     <tr>         <td colspan="2" align="center" valign="bottom">             <form name="f" action="your results page address" id="cse-search-box" method="get" target="_blank">                 <input type="hidden" name="cx" value="your cx value here" />                 <input type="hidden" name="cof" value="forid:9" />                 <input type="hidden" name="ie" value="utf-8" />                 <input type="text" name="q" id="q" autocomplete="off" size="51" class="txbx" />             </form>         </td>     </tr>     <tr>         <td style="height:35px;" width="45%" align="right" valign="middle">             <form name="s" action="your results page address" method="get">                 <input type="hidden" name="cx" value="" />                 <input type="hidden" name="cof" value="" />                 <input type="hidden" name="ie" value="" />                 <input type="submit" name="sa" value="search" class="btn" onclick="document.s.cx.value=document.f.cx.value; document.s.cof.value=document.f.cof.value; document.s.ie.value=document.f.ie.value;" />             </form>         </td>         <td width="55%" align="left" valign="middle">             <form name="g" action="http://www.google.co.uk/search" method="get">                 <input type="hidden" name="q" value="">                 <input name="btni" type=submit value="i'm feeling lucky" class="btn" onclick="document.g.q.value=document.f.q.value;" />             </form>         </td>     </tr> </table> 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -