關于Firefox的許多技巧都需要您來編輯Mozilla Firefox的配置文件.這里面有三個配置文件您應當知道的:
user.js - 用來改變各種選項.
userChrome.css - 用 來改變瀏覽器的外觀.
userContent.css - 用來改變網頁的外觀.
所有的這些文件都純文本文件,存儲在您的配置文件夾里面,并可以使用任何一個標準的編輯器來編輯它們,比如:windows系統中的記事本或者Texturizer和Linux系統中的gedit或者kate
配置文件夾
在開始配置您的文件之前,您應當知道怎么找到通常稱為"配置文件夾".配置文件夾是位于您硬盤中某處,供 Mozilla Firefox 存放您的所有個人設置的地方.
在Windows 95/98/Me的系統里,這個文件夾的路徑通常是:C:\WINDOWS\Application Data\Phoenix\Profiles\default\xxxxxxxx.slt\,這里 xxxxxxxx是一個8位的隨機數. 打開C:\WINDOWS\Application Data\Phoenix\Profiles\這個文件夾瀏覽就行了,其他的東西則是一目了然了.
在Windows 2000/XP系統中,這個路徑通常是:%AppData%\Phoenix\Profiles\default\xxxxxxxx.slt\.
在Linux系統下,路徑是:~/.phoenix/default/xxxxxxxx.slt.
在MacOS X系統下,路徑是:~/Library/Phoenix/Profiles/default/xxxxxxxx.slt.
注意: Mozilla Firefox允許不只一個用戶,當然也不只一個配置文件了.上面例子中的路徑指的是默認的配置文件,這個文件在您第一次起動Mozilla Firefox時,由它自動創建. 使用配置文件管理器您可管理任意多的配置文件.
在windows 2000/XP 系統下,變量 %AppData%是一個對Application Data路徑的簡記形式. 使用這個變量的時候,僅僅需要在資源管理器的地址欄中輸入 %AppData%然后按Enter就可以了. 您會被代到真正的文件夾下,一般情況下可能是: C:\Documents and Settings\[User Name]\Application Data.
user.js
這個文件是Mozilla Firefox的一個主要配置文件,位于您配置文件夾里. 默認的情況這個文件并不存在,那么您必需在您加入您的配置之前創建它.
Windows 用戶:如果您知道如何創建一個文件,就跳過一節.在您創建文件之前,您必要確認一下,您可以看到文件的擴展名.起動資源管理器(點擊桌面上的我的電腦的圖標)然后選擇: 文件 > 工具 > 文件夾選項.... 點擊查看標簽頁,然后取消隱藏已知文件類型的擴展名選項. 現在,回到您的配置文件夾,然后選擇文件 > 新建 > 文本文件. 默認的名字是新建文本文件.txt的文件出現了.把名字改成user.js (當警告框出現的時候點擊確定).
Linux 用戶: 如果您正在使用Linux系統,我假定您是知道如果創建一個新文件的.在您的配置文件夾內創建一個文件名為 user.js.
您可以通過在地址欄中輸入about:configEnter來進入編輯保存在user.js中的參數選項.您會在Mozilla Firefox中看到一個所有的可用參數選項的列表(大部分是從Mozilla那里引入,其中有一些并沒有使用也沒有被移除) .雙擊一個參數選項來改變它的值.您做的改變會立即保存在由Mozilla Firefox自動創建的文件prefs.js中.
userChrome.css
這個文件用來設置在Mozilla Firefox用戶界面上的各個元素的顯示規則,文件位置您的配置文件夾下一個名字叫chrome的子文件夾里. 和user.js文件一樣,這個文件默認情況下并不存在, 您也要在加入您的選項之前創建它.不過默認的情況下是存在一個例子文件的,名字叫 userChrome-example.css. 基本上,您是可能把這個文件重命名一下就行了,也就是刪去后面的-example部分.
userContent.css
這個文件用來設置網頁內容的顯示規則,它也位置配置文件夾下的chrome的子文件夾里.默認時和user.js文件一樣,這個文件 并不存在 在您設置您的選項之前您要創建它.和userChrome.css文件一樣,默認情況下,有一個例子文件叫userContent-example.css. 基本上您就重命名一個這個文件則可,也就是刪去后面的-example部分.
提示 & 技巧
以下包含的各種技巧,大部分要編輯配置文件,如果您不熟悉基本的文件,文件夾用法,建議您不要修改,這一頁按技巧的重要性排列,分為4個部分
瀏覽器外觀
用 W indows XP 菜單
如果您用的系統是 Windows XP 并且想用默認的菜單類型, 把下面的代碼加到 userChrome.css 文件:
/* Make menus XP style */
menupopup, popup {
border: 1px solid ThreeDShadow !important;
-moz-border-left-colors: ThreeDShadow !important;
-moz-border-top-colors: ThreeDShadow !important;
-moz-border-right-colors: ThreeDShadow !important;
-moz-border-bottom-colors: ThreeDShadow !important;
padding: 1px !important;
background-color: Menu !important;
}
menubar > menu {
border: 1px solid transparent !important;
padding: 2px 5px 2px 7px !important;
margin: 0 !important;
}
menubar > menu[_moz-menuactive="true"] {
background-color : Highlight !important;
color: HighlightText !important;
}
用經典的windows (9x/Me/2000) 菜單
不幸的是,目前默認的菜單類型是 Windows XP 和原先舊版本 Windows3D 外觀的折衷,如果您想 要 Windows 經典的外觀,把下面的代碼加到 userChrome.css 文件:
/* Windows Classic (9x/Me/2000) style Menus */
menupopup, popup {
border: 2px solid !important;
-moz-border-top-colors: ThreeDLightShadow ThreeDHighlight;
-moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;
-moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow;
-moz-border-left-colors: ThreeDLightShadow ThreeDHighlight;
padding: 1px !important;
}
menubar > menu[disabled="true"] {
border: 1px solid transparent !important;
}
menubar > menu[_moz-menuactive="true"] {
border-top: 1px solid ThreeDHighlight !important;
border-right: 1px solid ThreeDShadow !important;
border-bottom: 1px solid ThreeDShadow !important;
border-left: 1px solid ThreeDHighlight !important;
background-color: transparent !important;
color: MenuText !important;
}
menubar > menu[_moz-menuactive="true"][open="true"] {
border-top: 1px solid ThreeDShadow !important;
border-right: 1px solid ThreeDHighlight !important;
border-bottom: 1px solid ThreeDHighlight !important;
border-left: 1px solid ThreeDShadow !important;
}
用自己的圖片做工具欄的背景
除了改變主題以外,您頁可以用自己的圖片做工具欄的背景。 把下面的代碼加到 userChrome.css 文件:
/* Use a background imag e for the toolbars:
(Substitute your image file for background.gif) */
menubar, toolbox, toolbar, .tabbrowser-tabs {
background-image: url("background.gif") !important;
background-color: none !important;
}
可以把圖片放在 userChrome.css 文件一樣的目錄下. 圖片格式可以是Mozilla Firefox 支持的任意格式。
使動態的標簽頁更易區分
為了使動態的標簽頁和已經打開的標簽頁更易區分開(通過顏色)來把下面的代碼加到, userChrome.css 文件:
/* Change color of active tab */
tab[selected="true"] {
background-color: rgb(222,218,210) !important;
color: black !important;
}
/* Change color of normal tabs */
tab {
background-color: rgb(200,196,188) !important;
color: gray !important;
}
不在動態標簽也上使用粗體文本
如果您不想在動態標簽頁上使用粗體,加下面的代碼到 userChrome.css 文件:
/* Make the active tab easier to distinguish: */
tab[selected="true"] {
font-weight: normal !important;
}
從標簽欄刪除“關閉”按鈕
您可以把“關閉”按鈕從標簽欄刪除,把下面代碼加到 userChrome.css :
/* Remove the close button on the tab bar */
.tabs-closebutton {
display: none !important;
}
仍然可以關閉標簽頁,右擊標簽頁選擇“關閉標簽”或按 Ctrl+W
Remove items from the main menu
有些人為了節省水平空間喜歡把工具欄象菜單一樣豎立的放置, 把下面代碼加到r userChrome.css :
/* Remove the Go and Help menus */
menu[label="Go"],
menu[label="Help"] { display: none !important; }
改變窗口圖標
Mozilla Firefox 默認沒有使用自己圖標而是 Mozilla 圖標,在一些系統里系統圖標被使用,如果您想使用自己圖標,遵循下面的方法
進入您安裝 Mozilla F irefox的目錄 (如 >C:\Program Files\Firefox\) 下的子目錄 chrome.
建立子目錄icons, 在它里面生成子目錄 default.
完整的目錄現在是 C:\Program Files\Firefox\chrome\icons\default\
選擇您想使用的圖標 (在 Windows 平臺用 .ico 文件, 在Linux 平臺xpm 文件) 放到這個目錄重命名為r and main-window.[文件類型], e.g. main-window.ico 在 Windows and在linux main-window.xpm
In addition to the main window, you can also change the icon on the Bookmark Manager and JavaScript Console. The icon names are bookmark-window.[filetype] and jsconsoleWindow.[filetype], respectively.
在右邊顯示側欄
為了在右邊顯示側欄而不是在左邊, 把下面代碼加到 userChrome.css 文件:
/* Place the sidebar on the right edge of the window */
window > hbox {
direction:rtl;
}
window > hbox > * {
direction:ltr;
}
改變搜索條的寬度
搜索條默認相對比較小,您可以自己以特定數量的像素指定它的寬度,下面代碼加到userChrome.css 文件:
/* Make the Search box flex wider */
#search-container {
-moz-box-flex: 400 !important;
}
Open external links in new windows or tabs
如果有外部的程序要在默認的瀏覽器里打開網頁,Mozilla Firefox用一個幾經存在的窗口打開它,這意味瀏覽器可能從一個您正在瀏覽的頁面跳轉,如果不希望這發生,加下面的代碼到 user.js 文件:
// Stop reusing active windows:
user_pref("advanced.system.supportDDEExec", false);
想打開新標簽頁而不是窗口怎么辦那?What about new tabs instead of windows then? If you prefer tabs instead of windows, 您必須安裝Tabbrowser Extensions, 它是一個強有力的標簽式瀏覽的擴展,安裝完后按下面的指令來做
確保不要忘記把上面的代碼加到 user.js 文件.
選擇 工具》選項》擴展, 選擇 標簽式瀏覽 單擊 設置.
展開目錄列表選擇最上面的子目錄
在“窗口”模式下下拉列表,選擇“打開時用多個瀏覽器”
現在外部的程序打開鏈接時就會在新的標簽頁打開。
使標簽欄一直顯示
當只有一個標簽頁的時候標簽欄就會隱藏. 為了使標簽欄一直顯示, 加下面的代碼到r user.js 文件:
// Disable tab bar autohide feat ure:
user_pref("browser.tabs.autoHide", false);
注意當只有一個標簽頁時您仍然可以通過單擊“關閉” X 隱藏標簽欄
取消 target="_blank"
Mozilla Firefox 默認有一個內建的阻止彈出窗口的過濾器,但當用target="_blank"或無效的target="_new"打開新窗口時它停止網頁,為了在同一窗口打開鏈接,加下面的代碼到 f user.js 文件:
// disable target="_blank" (open in same window):
user_pref("browser.block.target_new_window", true);
關閉圖像自動縮放功能
當這一特性打開時, 它會縮小圖像以使比圖像小的窗口可以容下圖像. 為了關閉這以功能加下面的代碼到 user.js 文件:
// Turn off Automatic Image Resizing:
user_pref("browser.enable_automatic_image_resizing", false);
用錯誤頁而不是對話框顯示
當聯結失敗時Mozilla Firefox 默認不是象IE一樣顯示錯誤頁,而示顯示惱人的錯誤信息,要顯示錯誤頁而不是錯誤信息,加下面的代碼到 user.js 文件:
// Instead of annoying error dialog messages, display pages:
user_pref("browser.xul.error_pages.enabled", true);
.
用下載管理器而不是進度窗口
下載文件時, Mozilla Firefox 默認顯示進度窗口,如果同時下載多個文件,這些窗口會弄亂您的桌面的,而下載管理器則不會,加下面的代碼到 user.js 文件起用下載管理器:
// Instead of download progress windows, use the Sidebar:
user_pref("browser.download.openSidebar", true);
user_pref("browser.download.useProgressDialogs", false);
用好輸入查找功能
Find As You Type功能, Mozilla 新介紹的一個新功能, 有一些適合您需要的隱藏功能, 加下面的代碼到ruser.js 文件:
// Find As You Type Configuration:
// Set this pref to false to disable Find As You Type:
user_pref("accessibility.typeaheadfind", true);
// If you set this pret to true, typing can automatically start Find As You Type.
// If false (default), you must hit / (find text) or ' (find links) before your search.
user_pref("accessibility.typeaheadfind.autostart", true);
// Set this pref to false if you want Find As You Type to search normal text too:
user_pref("accessibility.typeaheadfind.linksonly", true);
// Set this pref to true if you require that the link starts with the entered text:
user_pref("accessibility.typeaheadfind.startlinksonly", false);
// This is the time in milliseconds for the Find As You Type to stop watching for keystrokes:
user_pref("accessibility.typeaheadfind.timeout", 3000);
平滑滾動
Mozilla Firefox 0.6 默認有一個平滑滾動的功能,要打開或關閉這一特性,加下面的代碼到 Scrollinguser.js 文件:
// Smooth Scroll ing (true = on, false = off):
user_pref("general.smoothScroll", true);
禁止其它 JavaScript 窗口特性
Mozilla Firefox 有一些選項來決定那些scripts可以在窗口使用,這些選項在“工具”》選項》網頁特效》高級,這而的選項沒有包含全部的特效,還有其它的一些特效可以使用:
// More DOM/JavaScript options
// Make sure all pop-up windows are resizable:
user_pref("dom.disable_window_open_feature.resizable", true);
// Make sure all pop-up windows are minimizable:
user_pref("dom.disable_window_open_feature.minimizable", true);
// Always display the menu in pop-up windows:
user_pref("dom.disable_window_open_feature.menubar", true);
// Always display the Navigation Toolbar in pop-up windows:
user_pref("dom.disable_window_open_feature.location", true);
使用Netscape 6/7 或 Mozilla 書簽
如果您正在使用 Netscape 6/7 或 Mozilla, 您可以 使 Mozilla Firefox 使用這些書簽. 所有的書簽保存在一個名為 bookmarks.html 的文件里,例如,如果您想在 Firefox 里使用Netscape 7的書簽,加下面的代碼到 user.js 文件:
// Specify which bookmarks file to use:
user_pref("browser.bookmarks.file", "C:\\Path To Netscape Profile\\bookmarks.html");
Remember to use two backslashes for the path separators if you're using Windows, e.g. C:\\Path\\bookmarks.html instead of C:\Path\bookmarks.html.
改變地址欄的搜索模式
默認情況下在搜索欄輸入關鍵字按回車,將執行一個B "I'm Feeling Lucky" 搜索,如果您想使用標準的搜索模式,加下面的代碼到, user.js 文件:
// Change to normal Google search:
user_pref("keyword.URL", http://google.com/search?btnG=Google+Search&q=);
當然可以通過改變特定字符串來改變搜索引擎,默認的是: "http://www.google.com/search?btnI=I%27m+Feeling+Lucky&q=".
禁止書簽圖標
您可以禁止書簽圖標的顯示加下面的代碼到 user.js 文件:
// Disable Bookmark Icons
user_pref("browser.chrome.site_icons", false);
user_pref("browser.chrome.favicons", false);
改變 throbber URL
當您單擊 throbber, 瀏覽器會聯向 www.mozilla.org. 這以網址可以改變,加下面的代碼到 user.js 文件:
// Click o n throbber to go to Mozilla Firefox Help:
user_pref("browser.throbber.url", "http://texturizer.net/firefox/");
不在地址欄保存 URLs
Mozilla Firefox 允許您輸入的地址不出現在地址欄的下拉菜單里面,這可以保護您的隱私。
網頁外觀
禁止廣告
網站上的廣告是惱人的,下面的代碼可以阻止大部分的廣告,由于這代碼較長放到其它頁了看,separate page.
禁止閃爍元素
您也許不想看到上面閃爍的元素. 為了阻止它, 加下面的代碼到 user.js 文件:
// Put an end to blinking text!
user_pref("browser.blink_allowed", false);
禁止 "marquee"標簽
一些網站用卷動的標簽 . 如果您覺的它沒用的話加下面代碼來禁止它,加到 userContent.css 文件:
/* Stop those <marquee> tags! */
marquee {
-moz-binding : none !important;
display : block;
height : auto !important;
}
If you added the code, this text should not scroll after restarting Mozilla Firefox.
使框架大小可變
許多網站用框架來顯示目錄,有時候這些框架太小了. 為了使這些框架大小可變, 加到 user.js 文件:
// Force frames to be resizable
user_pref("layout.frames.force_resizability", true);
注意有時候它會使您的頁面變的比較滑稽:)
修改打開新窗口鏈接的光標
在打開一個新窗口時,這個提示將改變鼠標當經過鏈接時,執行一個 JavaScript 命令. 加到
userContent.css 文件:/* Change cursor for links that open in new window */
:link[target="_blank"], :visited[target="_blank"], :link[target="_new"], :visited[target="_new"] {
cursor: crosshair;
}
修改 JavaScript 鏈接的光標
這個提示將改變鼠標當經過鏈接時,執行一個 JavaScript 命令. 加到 userContent.css 文件:
/* Change curso r for JavaScript links */
a[href^="javascript:"] {
cursor: move;
其它提示
改變網頁的語言
一些網站提供多國語言的版本,您可以按優先順序選擇語言,要改變優先順序,您不得不知道各國語言的語言代碼如瑞典語代碼是sv,下面的例子是user.js里的一個。:
// Change language to Swedish (default is "en, en-us")
user_pref("intl.accept_languages", "sv, en, en-us");
注意: 選項窗口中有一個request 域用于存放此選項。
選擇和復制獨立的表格單元
當按下Ctrl 健, 您可以選擇表格單元. J您頁可以選擇多個表格單元 一旦選好后您可以象文本一樣復制和粘貼您選擇的內容 。
加速網頁顯示
Mozilla Firefox 默認不顯示頁面在 250毫秒, 因為它在等待數據. 如果把下面的代碼加到 user.js 文件, Mozilla Firefox 立即顯示網頁, 即使沒有完成的數據 它的缺點是在一個慢的機器上由于“回流”使得整個頁面的裝載時間長了。
// This one makes a huge difference. Last value in milliseconds (default is 250)
user_pref("nglayout.initialpaint.delay", 0);
起用線性管道 Pipelining
Pipelining 是一個實驗中的特性, 它設計來提高網頁裝載效率, 不幸的是不是所有的網站和代理都支持它, servers and想試用它的話加下面的代碼到 user.js 文件:
// Enable pipelining:
user_pref("network.http.pipelining", true);
user_pref("network.http.proxy.pipelining", true);
user_pref("network.http.pipelining.maxrequests", 100);
指定保存緩存的位置
為了指定緩存保存在那一個目錄, 加代碼到 user.js 文件:
// Path to Cache folder:
user_pref("browser.cache.disk.parent_directory","C:\\Path To Cache");
記得用2個斜杠做路徑的分割符, i如果您使用 Windows, e.g. C:\\Path To Cache 而不是 C:\Path\Path To Cache.
指定內存緩存的用處
一般地, Mozilla Firefox 根據有效內存的多少來判斷緩存的用處,為了指定特定數量的內存緩存,加代碼到 . user.js 文件:
// Specify the amount of memory cache:
// -1 = determine dynamically (default), 0 = none, n = memory capacity in kilobytes
user_pref("browser.cache.memory.capacity", 4096);
完全禁止內存緩存,用下面的代碼,
// Disable memory cache:
user_pref("browser.cache.memory.enable", false);
訪問更多的首選項
許多首選項沒有在選項窗口體現. 下面的鏈接顯示了原始的首選項窗口, chrome://communicator/content/pref/pref.xul.
Note that many of the preferences in this window will have no effect in Mozilla Firefox, such as the Quick Launch option. Also, this window will most probably be removed completely in future versions of Mozilla Firefox.

