這篇文章主要介紹“搜索欄不支持https怎么解決”的相關知識,小編通過實際案例向大家展示操作過程,操作方法簡單快捷,實用性強,希望這篇“搜索欄不支持https怎么解決”文章能幫助大家解決問題。

創(chuàng)新互聯(lián)專注于牟平網站建設服務及定制,我們擁有豐富的企業(yè)做網站經驗。 熱誠為您提供牟平營銷型網站建設,牟平網站制作、牟平網頁設計、牟平網站官網定制、小程序制作服務,打造牟平網絡公司原創(chuàng)品牌,更為您提供牟平網站排名全網營銷落地服務。
第一種方法:通過js實現
但是最近做一個客戶需求的時候突然想到了一個曲線求國的辦法,反正我測試百度站內搜索在https網站上是能用了,而且方法特別的暴力...
思路就是,做一個input,做一個button,在input里面輸入關鍵詞,用js控制點擊button直接打開百度站內搜索url+關鍵詞。反正能用了,我也不知道這么干對不對。。。
上代碼:
<inputtype="text"name="q"id="bdcsMain"value="百度站內搜索"onfocus="if(value=='百度站內搜索'){value=''}"onblur="if(value==''){value='百度站內搜索'}">
<buttonclass="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>
只需要復制你百度站內搜索結果頁的url替換掉上面代碼中的“http://zhannei.baidu.com/cse/search?s=1849457021752692468&entry=1&q=”就OK了。
第二種方法:通過php跳轉實現
搜索代碼不是js的
<formaction="http://so.php.cn/cse/search"method="get"target="_blank"class="bdcs-search-form"id="bdcs-search-form">
<inputname="s"value="10520733385329581432"type="hidden">
<inputname="entry"value="1"type="hidden">
<inputname="ie"value="gbk"type="hidden">
<inputname="nsid"value="3"type="hidden">
<inputname="ie"value="gbk"type="hidden">
<inputtype="text"placeholder="請輸入您感興趣的關鍵字"value=""id="search_txt1"maxlength="18"class="search_txt"name="q">
<inputclass="search_btn"value="搜索"type="submit">
</form>
修改以后將action換成本地的php文件
<pclass="search">
<formaction="/do/search.php"method="get"target="_blank"class="bdcs-search-form"id="bdcs-search-form">
<inputname="s"value="10520733385329581432"type="hidden">
<inputname="entry"value="1"type="hidden">
<inputname="ie"value="gbk"type="hidden">
<inputname="nsid"value="3"type="hidden">
<inputname="ie"value="gbk"type="hidden">
<inputtype="text"placeholder="請輸入您感興趣的關鍵字"value=""id="search_txt1"maxlength="18"class="search_txt"name="q">
<inputclass="search_btn"value="搜索"type="submit">
</form>
</p>
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");
?>
關于“搜索欄不支持https怎么解決”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關的知識,可以關注創(chuàng)新互聯(lián)行業(yè)資訊頻道,小編每天都會為大家更新不同的知識點。
新聞名稱:搜索欄不支持https怎么解決
文章起源:http://chinadenli.net/article46/ppdihg.html
成都網站建設公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網站、品牌網站制作、虛擬主機、動態(tài)網站、網站排名、網頁設計公司
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)