摘要: 本文介紹主流瀏覽器的搜索引擎插件標準。本文還解釋如何在瀏覽器的添加搜索引擎插件。
本文內容:
簡介
現今主流的瀏覽器基本都支持在搜索欄上添加自定義的搜索引擎。當然,不同的瀏覽器採用的搜索引擎添加方式不同,下面就我所知道的4種方式逐一作一介紹。
四、 .ini配置文件
在Opera中採用此種方式,在Search.ini文件中定義了支持Opera搜索欄上的搜索引擎。文件格式如下:
Opera Preferences version 2.0
; Do not edit this file while Opera is running
; This file is stored in UTF-8 encoding
[Version]
File Version=8
[Search Engine 1]
Name=
URL=http://www.google.com/search?q=%s&sourceid=opera&num=%i&ie=utf-8&oe=utf-8
Query=
Key=g
Is post=0
Has endseparator=0
Encoding=utf-8
Search Type=0
Verbtext=0
Position=-1
Nameid=17171
[Search Engine 2]
Name=
URL=http://search.opera.com/?search=%s&global=no
Query=
Key=s
Is post=0
Has endseparator=0
Encoding=utf-8
Search Type=3
Verbtext=0
Position=-1
Nameid=69677
……
[Search Engine 35]
Name=XXX
Verbtext=0
URL=http://www.XXX.com/product/productlist.aspx?submit=search&description=%s
Query=
Key=cv
Is post=0
Has endseparator=-1
Encoding=gbk
Search Type=0
Position=-1
Nameid=0
一般在Opera中添加搜索不需要在.ini 文件中配置,在瀏覽器中就可以設置。
點擊菜單Tools->Preferences,打開Preferences面板,點擊Search Tabpage,如下圖顯示Search Engine:
圖13
這裏可以管理Opera瀏覽器上的瀏覽器引擎。包括Add、Edit、Delete。
對XXX這個搜索引擎,點擊Edit,可以查看XXX這個引擎的具體信息。
圖14
對應到.ini文件中爲:
[Search Engine 35]
Name=XXX
Verbtext=0
URL=http://www.XXX.com/product/productlist.aspx?submit=search&description=%s
Query=
Key=cv
Is post=0
Has endseparator=-1
Encoding=gbk
Search Type=0
Position=-1
Nameid=0
指定了Search Engine的Name、Keyword、Address,如果使用POST請求,指定的Query String。
在URL中,採用%s來指代在搜索欄中輸入的關鍵字。
圖15 Opera搜索欄
當然,Opera幫助中提供了另一種自動添加搜索引擎的方式,非常的方便。
Adding a new search is most conveniently done as follows:
1、Go to the site that has the search you want.
2、Right-click the search field.
3、Select "Create search" from the context menu.
4、Edit the name of the search engine to your liking.
5、Add a short keyword to be able to use the search engine directly from the address field, as described above.
6、Click "OK", and the new search is added and can be used anywhere within Opera.
圖16
圖 17
在這裏,我們可以發現,Opera爲我們創建的搜索引擎,輸入Keyword後,點擊OK就可以添加。使用了POST請求。
Address=http://www.XXX.com/index.aspx
QueryString=__EVENTTARGET=&__EVENTARGUMENT=&CVState2008=%2FwEPDwUJ
NzU0MDM3NDM3ZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WBgUi
SXRlbVN1bW1hcnlDb250cm9sOkJ1dHRvbkFkZFRvQ2FydAUiSXRlbVN1bW1hcnlDb250
cm9sOkJ1dHRvbkFkZFRvQ2FydAUiSXRlbVN1bW1hcnlDb250cm9sOkJ1dHRvbkFkZFRv
Q2FydAUiSXRlbVN1bW1hcnlDb250cm9sOkJ1dHRvbkFkZFRvQ2FydAUiSXRlbVN1bW1
hcnlDb250cm9sOkJ1dHRvbkFkZFRvQ2FydAUiSXRlbVN1bW1hcnlDb250cm9sOkJ1dHR
vbkFkZFRvQ2FydA%3D%3D&description=%s&Search%3AStoreList=&txtSubEmail=
Enter+Email+Address&qty=1&qty=1&qty=1&qty=1&qty=1&qty=1&x=0&y=0