Google自定义搜索 [英] Google Custom Search

查看:109
本文介绍了Google自定义搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Code项目,

我在应用程序中使用Google自定义搜索(GCS).我为此创建了一个单独的页面,名为"GoogleCustomSearch",它的确可以正常工作..

但是我的问题是,如何使用此GCS在母版页中进行搜索?

预先感谢您:)


好的,到目前为止,我的代码受到关注,在这里我还发布了代码:

//此代码在HEAD部分下

Hello Code Project,

I''m using Google Custom Search (GCS) in my application. I have created separate page named "GoogleCustomSearch" for that, and its indeed working fine..

But my question is, how can I search from the Master Page using this GCS?

Thanking you in advance :)


Okay so my code is being concerned so far, here I have also posted the code:

//this code is under HEAD section

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



//此代码在结果页上



// this code is on Result page

<gcse:search></gcse:search>



因此,尽管我已将代码放在母版页上,但在这里我仍可以从结果页执行搜索.我无法在结果页上获得结果....



So here I am able to perform search from result page, though I have put my code on master page I am not able to get the result on Result page....

推荐答案

只需复制此代码即可将其粘贴到母版页的ASP编码中.
如果没有用,请问一个问题,说明您的问题.
Just Copy paste this code into ASP coding of your Master Page.
and if this didnt work, then ask a question stating your problem.


这篇关于Google自定义搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆