Firefox (简体中文)
相关文章
Firefox(火狐)是Mozilla(谋智网络)出品的一款图形界面网络浏览器。
Contents
- 1 安装
- 2 附加组件
- 3 Configuration
- 4 插件
- 5 小技巧
-
6 疑难解答
- 6.1 Firefox 启动时间太长
- 6.2 字体问题
- 6.3 设置 email 客户端
- 6.4 文件关联
- 6.5 Firefox 自动创建 ~/Desktop,但我不需要
- 6.6 禁止插件弹窗
- 6.7 中键点击问题
- 6.8 Backspace 键无法实现“后退”功能
- 6.9 无法记录登录信息
- 6.10 使用深色 GTK+ 主题时文本区域故障
- 6.11 关闭Firefox时不询问是否保存标签
- 6.12 从Marketplace安装桌面应用失败且无错误提示
- 6.13 Firefox detects the wrong version of my plugin
- 6.14 在一些网页中,Javascript 上下文菜单不显示
- 6.15 Firefox 不保存默认的拼写检查语言
- 6.16 一些 MathML 符号消失了
- 6.17 滚动时图片闪烁
- 6.18 全屏模式下视频断裂
- 6.19 GTK+ >=3.20 时 Firefox 看起来很丑
- 7 参见
安装
安装 软件包 firefox.中文界面请安装简体中文语言包 firefox-i18n-zh-cn。
其它变种:
- Firefox Extended Support Release — 长期支持版本
- Firefox Beta — 前沿版本
- Firefox Developer Editi/Aurora — 开发者版本
- Firefox Nightly — 每日构建的测试版本
- Firefox KDE — OpenSUSE 打过补丁的、具有更好的 KDE 集成特性的 Firefox 版本。
- 除了不同的编译渠道,有些特殊的分支版本提供了一些特殊功能,参考 List of applications#Gecko-based.
这里包含了不同版本的说明.
附加组件
Firefox 广为人知的一点是它的大量的附加组件,可以用来添加新功能或更改 Firefox 中已有功能。你可以在 Firefox 中的“附加组件管理器”中查找新附加组件或管理已安装的附加组件。
想查看热门附加组件列表,参见: 按热门度排序的附加组件列表.
添加搜索引擎
可以使用附加组件向 Firefox 中添加搜索引擎,戳 这个页面 查看可用的搜索引擎列表.
在 Mycroft Project 可以找到大量的搜索引擎.
你也可以使用 add-to-searchbar 插件,在网站的搜索框右击,然后选择 Add to Search Bar... 将任何网站的搜索框添加到搜索栏.
arch-firefox-search
安装 arch-firefox-search 添加 Arch 相关的搜索项目 (AUR, wiki, 论坛等等) 到 Firefox 搜索栏.
Configuration
Firefox exposes a number of configuration options. To examine them, enter:
about:config
in the Firefox address bar.
Once set, these affect the user's current profile, and may be synchronized across all devices via Firefox Sync. Please note that only a subset of the about:config
entries are synchronized by this method, and the exact subset may be found by searching for services.sync.prefs
in about:config
. Additional preferences and 3rd party preferences may be synchronized by creating new boolean entries prepending the config value with services.sync.prefs.sync
(documentation is still applicable.) To synchronize the whitelist for the extension NoScript:
services.sync.prefs.sync.capability.policy.maonoscript.sites
The boolean noscript.sync.enabled
must be set to true to synchronize the remainder of NoScript's preferences via Firefox Sync.
Firefox also allows configuration for a profile via a user.js
file: user.js kept in the profile folder, usually ~/.mozilla/firefox/some name.default/
. For a useful starting point, see e.g custom user.js which is targeted at privacy/security conscious users.
One drawback of the above approach is that it is not applied system-wide. Furthermore, this is not useful as a "pre-configuration", since the profile directory is created after first launch of the browser. You can, however, let firefox create a new profile and, after closing it again, copy the contents of an already created profile folder into it.
Sometimes it may be desired to lock certain settings, a feature useful in widespread deployments of customized Firefox. In order to create a system-wide configuration, follow the steps outlined in Locking preferences:
1. Create /usr/lib/firefox/defaults/pref/local-settings.js
:
pref("general.config.obscure_value", 0); pref("general.config.filename", "mozilla.cfg");
2. Create /usr/lib/firefox/mozilla.cfg
(this stores the actual configuration):
// //...your settings... // e.g to disable Pocket, uncomment the following line // lockPref("browser.pocket.enabled", false);
Please note that the first line must contain exactly //
. The syntax of the file is similar to that of user.js
.
插件
参见: 浏览器插件
要查看插件使用情况,在Firefox地址栏输入:
about:plugins
或者使用工具菜单中的附加组件,选择插件标签。
Gnome Keyring 整合
要整合 Firefox 与 GNOME Keyring,安装 Javascript 实现的 mozilla-extension-gnome-keyring-gitAUR。要让 firefox-gnome-keyring 使用你的登录 keychain,在 about:config 中设置 extensions.gnome-keyring.keyringName 为 "login" (不含引号)。注意 "login" 的首字母应为小写。
KDE 整合
- 在 Firefox 中使用 GTK 外观。安装 breeze-gtk 和 kde-gtk-config。然后进入系统设置 -> 程序外观 -> GTK,GTK2/GTK3 主题选择为 Breeze,勾选显示 GTK 按钮的图标。
- 使用 KDE's KParts 嵌入文件查看器,可以安装 kpartsplugin[broken link: archived in aur-mirror]。
- 可以使用 AUR 中的 firefox-kde-opensuseAUR Firefox 变种来集成 KDE 的文件关联系统和文件对话框。
- 有些插件也提供了其它整合,比如集成 KWallet, Unityfox Revived, 和 Plasma 通知.
拼写检查字典
选择任意文本,右键为该语言添加字典,重启浏览器即可。
或者从 官方软件仓库安装软件包hunspell和其它语言例如 hunspell-fr (法语) or hunspell-he (希伯来语)。
默认情况下,Firefox 会在 /usr/lib/firefox/dictionaries
生成指向到 hunspell 字典的软链接。如果你不想使用所有语言的字典,可以删掉一部分。注意,Firefox 升级可能会还原这些软链接。
增加搜索引擎
到下面网址选择搜索引擎并安装:
add-to-searchbar 扩展可以通过网址直接加入搜索引擎。
arch-firefox-search
arch-firefox-search为Firefox搜索框添加Arch相关内容的搜索引擎(AUR、wiki、论坛……):
# pacman -S arch-firefox-search
多媒体播放
Firefox会尝试使用FFmpeg播放HTML5的<audio>
和<video>
标签内的多媒体内容,需要先安装ffmpeg。
重启Firefox。你可以到Youtube HTML5页面或者这个网页来验证软件包正确安装并启用了。
更多配置信息请参阅 Firefox tweaks#Enable additional media codecs。
小技巧
网页截图
要使用 Firefox 进行网页截图,使用 Shift+F2
打开开发者控制台。然后输入:
screenshot filename
其中 filename 是可选的。
要对整个页面进行截图而不仅仅是当前屏幕,使用 --fullpage
选项:
screenshot --fullpage filename
疑难解答
Firefox 启动时间太长
如果 Firefox 启动时间比其它浏览器更长,这可能是因为 /etc/hosts
里没有设置 localhost。查看 Network configuration#Local network hostname resolution 了解怎么设置。
字体问题
设置 email 客户端
一般地,Firefox 会使用像 Gmail 或 Yahoo Mail 这样的 Web 程序打开 mailto
链接。要使 Firefox 用你的email 客户端打开 mailto
链接,找到 选项 > 应用程序 并将 mailto
对应的动作修改为你的 email 客户端的准确路径,如 /usr/bin/kmail
。
Outside the browser, mailto
links are handled by the x-scheme-handler/mailto
mime type, which can be easily configured with xdg-mime. See Default applications for details and alternatives.
文件关联
请参考 Default applications.
Firefox 自动创建 ~/Desktop,但我不需要
Firefox 默认使用 ~/Desktop
作为上传和下载目录。按 XDG user directories 中的说明修改 XDG_DESKTOP_DIR
.
禁止插件弹窗
有些插件,如Flash,会忽略浏览器设置,弹出窗口。要阻止这种弹窗:
- 打开 about:config。
- 右键添加新的整数项目。
- 命名为 privacy.popups.disable_from_plugins。
- 设置为2。
可用值如下:
- 0: 允许所有插件弹窗。
- 1: 允许弹窗,但限制在dom.popup_maximum数值内。
- 2: 禁止插件弹窗。
- 3: 禁止插件弹窗,即使是可信站点。
中键点击问题
! 此 URL 无效,无法载入,
许多人使用中键点击时会莫名跳转到某页面,或者出现上述错误。
问题的原因是,许多类UNIX操作系统设置鼠标中键执行粘贴操作。这与Firefox的功能冲突了(在新窗口打开链接)。可以关闭Firefox的这项功能:
在浏览器地址栏输入:
about:config
打开并找到middlemouse.contentLoadURL项,设置为false。
此外,如果要打开中键点击出现滚轮的功能(Windows默认启用),设置general.autoScroll为true。
Backspace 键无法实现“后退”功能
根据此文,为了修正一个bug,关闭了此功能。开启方法如下:
在浏览器地址栏输入:
about:config
打开并找到browser.backspace_action项,设置为0。
无法记录登录信息
有可能是Firefox profile文件夹中的cookies.sqlite
损坏了。关闭浏览器后删除cookie.sqlite即可:
打开终端输入:
$ cd ~/.mozilla/firefox/xxxxxxxx.default/ $ rm -f cookies.sqlite
重启Firefox检查问题是否解决。
使用深色 GTK+ 主题时文本区域故障
使用深色 GTK+ 主题时,可能看不到某些网站输入框和文本区域的文字(例如:Amazon 会显示白底白字)。这可能是因为某些网站只设置了背景色或文本色,而 Firefox 主题使用了一样的颜色。Text Contrast for Dark Themes 扩展可以根据需要正确的设置颜色.
另一种方法是在 ~/.mozilla/firefox/xxxxxxxx.default/chrome/userContent.css
明确地设置所有网页的标准色彩或者使用 stylish 插件.
input:not(.urlbar-input):not(.textbox-input):not(.form-control):not([type='checkbox']) { -moz-appearance: none !important; background-color: white; color: black; } #downloads-indicator-counter { color: white; } textarea { -moz-appearance: none !important; background-color: white; color: black; } select { -moz-appearance: none !important; background-color: white; color: black; }
还可以强制 Firefox 使用亮色的主题 (例如 "Adwaita:light"):
- 把
/usr/share/applications/firefox.desktop
复制到~/.local/share/applications/firefox.desktop
,然后将所有的Exec=firefox
替换成Exec=env GTK_THEME=Adwaita:light firefox
. - 关闭所有的 Firefox 实例然后重启窗口管理器/桌面环境.
关闭Firefox时不询问是否保存标签
- 打开about:config。
- 修改browser.warnOnQuit为true。
- 修改browser.showQuitWarning为true.
从Marketplace安装桌面应用失败且无错误提示
安装会静默失败如果没有~/.local/share/applications
文件夹。
Firefox detects the wrong version of my plugin
When you close Firefox, the latter saves the current timestamp and version of your plugins inside pluginreg.dat
located in your profile folder, typically in ~/.mozilla/firefox/some name.default/
.
If you upgraded your plugin when Firefox was still running, you will thus have the wrong information inside that file. The next time you will restart Firefox you will get that message Firefox has prevented the outdated plugin "XXXX" from running on ...
when you will be trying to open content dedicated to that plugin on the web. This problem often appears with the official Adobe Flash Player plugin which has been upgraded while Firefox was still running.
The solution is to remove the file pluginreg.dat
from your profile and that is it. Firefox will not complain about the missing file as it will be recreated the next time Firefox will be closed.
[1]
在一些网页中,Javascript 上下文菜单不显示
在 about:config
取消 dom.w3c_touch_events.enabled
设置.
Firefox 不保存默认的拼写检查语言
默认的拼写检查语言可以用下面的方式设置:
- 在地址栏中打开
about:config
. - 把
spellchecker.dictionary
设置为你的语言,例如en_GB
. - 注意对于 Firefox 安装的词典插件来说,符号是
en-GB
,而对于 hunspell 词典来说,符号是en_GB
.
当你只有 hunspell 词典时, Firefox 可能不会保存你默认的词典语言设置。要解决这个问题,你可以添加至少一个 词典 插件. 注意现在附加组件中也会有词典栏.
StackExchange 上的相关问题: [2], [3], [4]
相关的漏洞报告: Bugzilla 776028, Ubuntu bug 1026869
一些 MathML 符号消失了
你需要一些数学字体,比如 Latin Modern Math 和 STIX (查看这个 MDN 页面: [5]) 以正确的显示 MathML.
在 Arch Linux 中,texlive-core 和 texlive-fontsextra 提供了这些字体,但是默认情况下设置字体却无法使用它们. 详情参见 TeX Live#Fonts. 你也可以尝试 Math fonts.
滚动时图片闪烁
设置中取消选中 "smooth scrolling":
编辑 > 设置 > 高级 > 通用 > 使用平滑滚动
全屏模式下视频断裂
如果你使用 Xorg Intel 或者 Nouveau 驱动并且感觉全屏模式下视频有撕裂感,试试 Firefox tweaks#Enable OpenGL Off-Main-Thread Compositing (OMTC).
GTK+ >=3.20 时 Firefox 看起来很丑
Firefox (从 47 版本开始) 不支持 GTK+ >=3.20 并且可能看起来很难看。一种办法是编译 Firefox 取消 GTK2 支持, 参见 firefox-esr-gtk2AUR. 另外,你可以使用 markzz's repository 或者 archlinuxcn's (x86_64 only) 的预编译 GTK2 Firefox 包.