百度站內(nèi)搜索不支持https怎么辦

這篇文章將為大家詳細(xì)講解有關(guān)百度站內(nèi)搜索不支持https怎么辦,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比萍鄉(xiāng)網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式萍鄉(xiāng)網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋萍鄉(xiāng)地區(qū)。費用合理售后完善,10年實體公司更值得信賴。

最近手機端開啟了https,為了綠鎖需要解決如下問題:

1、圖片

2、js

3、css樣式

4、form查詢也要用https

第一種方法:通過js實現(xiàn)

但是最近做一個客戶需求的時候突然想到了一個曲線求國的辦法,反正我測試百度站內(nèi)搜索在https網(wǎng)站上是能用了,而且方法特別的暴力...

思路就是,做一個input,做一個button,在input里面輸入關(guān)鍵詞,用js控制點擊button直接打開百度站內(nèi)搜索url+關(guān)鍵詞。反正能用了,我也不知道這么干對不對。。。

上代碼:

<input type="text" name="q" id="bdcsMain" value="百度站內(nèi)搜索" onfocus="if (value =='百度站內(nèi)搜索'){value =''}" onblur="if (value ==''){value='百度站內(nèi)搜索'}" >
 <button class="search-submit" id="btnPost" type="submit" onclick="window.open('http://zhannei.baidu.com/cse/search?s=1849457021752692468&entry=1&q='+document.getElementById('bdcsMain').value)">搜索</button>

只需要復(fù)制你百度站內(nèi)搜索結(jié)果頁的url替換掉上面代碼中的“http://zhannei.baidu.com/cse/search?s=1849457021752692468&entry=1&q=”就OK了。

第二種方法:通過php跳轉(zhuǎn)實現(xiàn)

搜索代碼不是js的

<form action="http://so.jb51.net/cse/search" method="get" target="_blank" class="bdcs-search-form" id="bdcs-search-form">
		<input name="s" value="10520733385329581432" type="hidden">
        <input name="entry" value="1" type="hidden">
        <input name="ie" value="gbk" type="hidden">
        <input name="nsid" value="3" type="hidden">
        <input name="ie" value="gbk" type="hidden">
<input type="text" placeholder="請輸入您感興趣的關(guān)鍵字" value="" id="search_txt1" maxlength="18" class="search_txt" name="q">
<input class="search_btn" value="搜 索" type="submit">
</form>

修改以后將action換成本地的php文件

<div class="search">
<form action="/do/search.php" method="get" target="_blank" class="bdcs-search-form" id="bdcs-search-form">
		<input name="s" value="10520733385329581432" type="hidden">
        <input name="entry" value="1" type="hidden">
        <input name="ie" value="gbk" type="hidden">
        <input name="nsid" value="3" type="hidden">
        <input name="ie" value="gbk" type="hidden">
<input type="text" placeholder="請輸入您感興趣的關(guān)鍵字" value="" id="search_txt1" maxlength="18" class="search_txt" name="q">
<input class="search_btn" value="搜 索" type="submit">
</form>
</div>

search.php如下

<?php
error_reporting(E_ALL & ~E_NOTICE);
$s=is_numeric($_GET['s'])?$_GET['s']:0;
$entry=$_GET['entry']?intval($_GET['entry']):0;
$nsid=$_GET['nsid']?intval($_GET['nsid']):0;
$ie=$_GET['ie']?substr($_GET['ie'],0,3):0;
$q=$_GET['q']?urlencode($_GET['q']):'';
$url_str="http://so.jb51.net/cse/search?s=$s&entry=$entry&ie=$ie&nsid=$nsid&ie=$ie&q=$q";
header("Location: $url_str");
?>

關(guān)于“百度站內(nèi)搜索不支持https怎么辦”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。

本文標(biāo)題:百度站內(nèi)搜索不支持https怎么辦
本文來源:http://www.muchs.cn/article40/geegho.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站網(wǎng)頁設(shè)計公司、軟件開發(fā)Google、品牌網(wǎng)站制作、商城網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁設(shè)計公司