2009-04-04

Google Toolbar干擾Firefox 3的網址列關鍵字的最佳解決法

Firefox 3有個功能就是可以直接在網址列(address bar)輸入關鍵字,然後透過google的服務幫你直接轉到最符合的網站,例如你在網址列輸入"氣象局",就會自動幫你轉到中央氣象局的網站 ,這其實就是google好手氣的功能,如果輸入的關鍵字比較沒有偏向某個網站的話,就會列出該關鍵字的google搜尋頁面.

不過在裝了google tool bar之後這個功能在輸入中文會有問題(變成亂碼或問號???),後來在網路上找了一下發現,原來是google tool bar會把這個功能改成導向about:neterror。

可以看這篇" 火狐娘搜尋列看不懂中文~? 你安裝了GOOGLE TOOLBAR了嗎? (解決方案) ".


(前面有一段廢話 最佳解請看最後一句)

在firefox的設定(about:config )中其實可以修改在網址列輸入關鍵字的對應動作

keyword.enabled 預設 true

keyword.URL 預設 http://www.google.com.tw/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=


當裝了google toolbar之後她會自動去把keyword.URL改成"about:neterror?e=query&u=",理論上about:neterror的功能要跟原本的一樣, 可是它不認識中文...

如果你直接在about:config裡面把keyword.URL改回預設值,只有暫時有用而已,下次重開又會被改回去。

網路上一般的解法都是去改google tool bar的程式toolbar.js 位於

XP
C:\Documents and Settings\[你的帳號]\Application
Data\Mozilla\Firefox\Profiles\[ 不一定的亂數 ]\extensions\{3112ca9c-de6d-4884-a869-9855de68056c}\lib\toolbar.js

Vista
C:\Users\[你的帳號]\AppData\Roaming\Mozilla\Firefox\Profiles
\[不一定的亂數]\extensions\{3112ca9c-de6d-4884-a869-9855de68056c}\lib\toolbar.js

Portable
Firefox3\Data\profile\extensions\{3112ca9c-de6d-4884-a869-9855de68056c}\lib\toolbar.js



其中有一段程式碼會偵測如果keyword.URL的內容沒有about:neterror的話,就把它替換成"about:neterror?e=query&u="

這是屬於一個名為LinkDoctor的功能

GTB_LinkDoctor.prototype.updatePreferences_=function(){
if(this.enabled_){
var keywordUrl=this.preferences_.getPref("keyword.URL");
if(!/^about\:neterror/.test(keywordUrl)){
this.backupPreference_("keyword.URL");
this.backupPreference_("keyword.enabled")
}
try{
this.editingKeyword_=true;
this.preferences_.setPref("keyword.URL","about:neterror?e=query&u=");
this.preferences_.setPref("keyword.enabled",true)
}finally{
this.editingKeyword_=false
}
}else{
this.restorePreference_("keyword.URL");
this.restorePreference_("keyword.enabled")
}
};


我注意到if(this.enabled_) 這句,似乎表示這個替換keyword.URL的功能應該是可以設定的。

然後就在about:config中找到了幾個關於linkdoctor設定

google.toolbar.linkdoctor.enabled //是否起用linkdoctor的功能

google.toolbar.linkdoctor.backup.keyword.URL //在替換keyword.URL 時 會將原本的值備份於此

google.toolbar.linkdoctor.backup.keyword.enabled

只要把keyword.URL改回預設值,再把google.toolbar.linkdoctor.enabled 設定為false就可以解決一切了

不過想想也奇怪,總覺得這樣的功能應該會有在做出介面才對, 最後才發現根本繞了一大圈...


其實只要在Google 工具列的 選項->搜尋->網頁瀏覽工具 取消勾選"當網址不正確或無法使用時提供建議"就可以了= =|||


沒有留言: