修正百度官方https站内搜索不能用,Google、百度、雅虎和360的站内搜索代码

  • 修正百度官方https站内搜索不能用,Google、百度、雅虎和360的站内搜索代码已关闭评论
  • 6,627 次浏览
  • A+
所属分类:WordPress主题

不能登陆请看公告!请看公告!请看公告!

为防止盗发或传播,本站部分软件做了特殊处理,如你下载后发现与本站不一致,请看公告!

本站博客使用百度站内搜索,一直搜索页面是空白,发现360等浏览器提示脚本风险,别人的站点都是好好的。研究了代码才发现,原来百度站长搜索不支持https,只能使用http,而且script脚本也是被拦截的。官方的代码不能用,怎么办呢,网上搜索了一下,代码都不能用,搞啥啊!忽然发现多年前的代码竟然能用,赶紧收藏下来,改了一下结构和风格,完美。

修正百度官方https站内搜索不能用,Google、百度、雅虎和360的站内搜索代码

对于一个网站来说,使用搜索引擎来进行站内搜索往往比自己编写的站内搜索更高效,并且不占用网站服务器的资源,下面是我搜集到的几个主要搜索引擎(Google和百度、雅虎)的站内搜索代码,使用时只需要将代码里的"xinyucn"替换成你的网址即可。

站内搜索代码:

1、google搜索:

<!--Google站内搜索开始-->

<form method=get action="http://www.google.com/search">

<input type=text name=q>

<input type=submit name=btnG value="Google 搜索">

<input type=hidden name=ie value=GB2312>

<input type=hidden name=oe value=GB2312>

<input type=hidden name=hl value=zh-CN>

<input type=hidden name=domains value="xinyucn">

<input type=hidden name=sitesearch value="xinyucn">

</form>

<!--Google站内搜索结束-->

2、百度搜索:

<!--Baidu站内搜索开始-->

<form target="_blank" action="http://zhannei.baidu.com/cse/site">

<input type="text" name="q" />

<input type="submit" value="Baidu 搜索">

<input name="ie" type="hidden" value="utf-8" />

<input name="cc" type="hidden" value="xinyucn" />

</form>

<!--Baidu站内搜索结束-->

3、雅虎搜索;

<!--Yahoo站内搜索开始-->

<form action="http://www.yahoo.com.cn/search">

<input type=text name="p">

<input type="submit" value="Yahoo 搜索">

<input type=hidden name=vs value="xinyucn">

</form>

<!--Yahoo站内搜索结束-->

4、360搜索;

<!--360站内搜索开始-->

<form target="_blank" action="https://www.so.com/s">

<input type="text" name="q" />

<input type="submit" value="360 搜索">

<input type="hidden" name="ie" value="utf-8">

<input type="hidden" name="src" value="https://www.xinyucn.cc/">

<input type="hidden" name="site" value="https://www.xinyucn.cc/">

<input type="hidden" name="rg" value="1">

<input type="hidden" name="inurl" value="">

</form>

<!--360站内搜索结束-->

下面是Google和百度的Javascript版的站内搜索代码:

<!--Google站内搜索开始-->

<script type="text/javascript">

function googlesearch () {

var wq=document.getElementsByName("wq")[0].value;

var link="http://www.google.com/search?domains=www.williamlong.info&sitesearch=xinyucn&q="+wq;

window.open(link); }

</script>

<input type="text" name="wq"/><input type="submit" onclick="javascript:googlesearch()" value="Google 搜索" />

<!--Google站内搜索结束-->

<!--Baidu站内搜索开始-->

<script language="javascript"> function baidusearch () {

var wd=document.getElementsByName("wd")[0].value;

var link="http://www.baidu.com/s?si=xinyucn&cl=3&ct=2097152&tn=baidulocal&word="+wd;

window.open(link); }

</script>

<input type="text" name="wd"/><input type="submit" onclick="javascript:baidusearch()" value="Baidu 搜索" />

<!--Baidu站内搜索结束-->

  • 官方微信公众号
  • 扫一扫关注微信公众号,如果你觉得本站帮到了你,请通过下面的赏字按钮捐赠本站,谢谢!
  • weinxin
  • 本站官方头条号
  • 扫一扫关注官方头条号,新老用户扫描下载抖音极速版,可领取最高269元现金,每天使用都可领钱。
  • weinxin