【问题标题】:Custom search engine for Google not working谷歌的自定义搜索引擎不起作用
【发布时间】:2015-06-19 06:11:54
【问题描述】:

我正在尝试集成谷歌的自定义搜索引擎,但无济于事。每次它为每个传递的数据返回“无结果”。 代码:

<script>
  (function() {
    var cx = '009439376788807650262:rd6prt0twra';
    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>
<div>
                            <gcse:search resultsUrl="http://amniltech.com.np/investment/" newWindow="true" queryParameterName="search">
                        </gcse:search>
                        </div>

有人可以帮我吗?我究竟做错了什么?我正在使用fuelphp。

【问题讨论】:

    标签: google-custom-search


    【解决方案1】:
      <script>
      (function() {
      var cx = 'Your_Cx_iD';
      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>
    <gcse:search resultsUrl="http://www.amniltech.com.np/investment/"        newWindow="true" queryParameterName="search">
    

    这会起作用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多