Firefox (简体中文)

From ArchWiki
Jump to: navigation, search
翻译状态: 本文是英文页面 Firefox翻译,最后翻译时间:2016-08-03,点击这里可以查看翻译后英文页面的改动。

Firefox(火狐)是Mozilla(谋智网络)出品的一款图形界面网络浏览器。

安装

安装 软件包 firefox.中文界面请安装简体中文语言包 firefox-i18n-zh-cn

其它变种:

  • Firefox Extended Support Release — 长期支持版本
https://www.mozilla.org/firefox/organizations/ || firefox-esrAUR or firefox-esr-binAUR
  • Firefox Beta — 前沿版本
https://www.mozilla.org/firefox/channel/#beta || firefox-betaAUR or firefox-beta-binAUR
  • Firefox Developer Editi/Aurora — 开发者版本
https://www.mozilla.org/firefox/channel/#developer || firefox-auroraAUR
  • Firefox Nightly — 每日构建的测试版本
https://nightly.mozilla.org/ || firefox-nightlyAUR
  • Firefox KDE — OpenSUSE 打过补丁的、具有更好的 KDE 集成特性的 Firefox 版本。
https://build.opensuse.org/package/show/mozilla:Factory/MozillaFirefox || firefox-kde-opensuseAUR

这里包含了不同版本的说明.

附加组件

Firefox 广为人知的一点是它的大量的附加组件,可以用来添加新功能或更改 Firefox 中已有功能。你可以在 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 整合

Warning: Since GTK3 was updated to 3.20.x, there are several broken themes. Including Breeze, the recommended theme for integration between KDE and GTK styles. Some of the issues are invisible scroll bars, no text highlight on selection, invisible checkboxes, among others. As a workaround while the themes are upgraded you can do the following after installing kde-gtk-config, go to System Settings -> Application Style -> GNOME Application Style (GTK) and choose in the Select a GTK3 Theme dropdown choose the Default theme, also make sure Show icons in GTK buttons and Show icons in GTK are checked. For further information on the compatibility issue above visit the GTK3 3.20 upgrade thread in the Arch Forums.
  • 在 Firefox 中使用 GTK 外观。安装 breeze-gtkkde-gtk-config。然后进入系统设置 -> 程序外观 -> GTK,GTK2/GTK3 主题选择为 Breeze,勾选显示 GTK 按钮的图标。
  • 使用 KDE's KParts 嵌入文件查看器,可以安装 kpartsplugin
  • 可以使用 AUR 中的 firefox-kde-opensuseAUR Firefox 变种来集成 KDE 的文件关联系统和文件对话框。

拼写检查字典

选择任意文本,右键为该语言添加字典,重启浏览器即可。

或者从 官方软件仓库安装软件包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

Tips and tricks

Screenshot of webpage

To use Firefox to take a screenshot of a webpage open the developer console using Shift+F2. Then type in:

screenshot filename

where filename is optional.

To take a screenshot of the entire page, not just the section displayed on the screen, use the --fullpage option:

screenshot --fullpage filename

疑难解答

Firefox startup takes very long

If Firefox takes much longer to start up than other browsers, it may be due to lacking configuration of the localhost in /etc/hosts. See Network configuration#Local network hostname resolution on how to set it up.

Font troubleshooting

See Font configuration.

设置 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.

文件关联问题

Gnome 用户可能遇到该问题,安装libgnome即可。

如果使用KDE,还可以这样:

ln -s ~/.local/share/applications/mimeapps.list ~/.local/share/applications/mimeinfo.cache

这样,Firefox应该严格使用KDE的文件关联设置了。

Firefox 自动创建 ~/Desktop,但我不需要

Firefox 默认使用 ~/Desktop 作为上传和下载目录。按 XDG user directories 中的说明修改 XDG_DESKTOP_DIR.

禁止插件弹窗

有些插件,如Flash,会忽略浏览器设置,弹出窗口。要阻止这种弹窗:

  1. 打开 about:config。
  2. 右键添加新的整数项目。
  3. 命名为 privacy.popups.disable_from_plugins。
  4. 设置为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
注意: xxxxxxxx 表示随机生成的8个字符

重启Firefox检查问题是否解决。

使用深色GTK主题时文本区域故障

使用深色GTK主题时,可能看不到某些网站输入框和文本区域的文字(白底白字)。这可能是因为某些网站只设置了背景色或文本色,而Firefox主题使用了一样的颜色。

A work around is to explicitly setting standard colours for all web pages in

可以在~/.mozilla/firefox/xxxxxxxx.default/chrome/userContent.css设置所有网页的标准色彩配置。

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;
}

Another workaround is to force Firefox to use a light theme (e.g. "Adwaita:light"):

  1. Copy /usr/share/applications/firefox.desktop to ~/.local/share/applications/firefox.desktop and replace all occurrences of Exec=firefox with Exec=env GTK_THEME=Adwaita:light firefox.
  2. Close all running instances of Firefox and restart your window manager/desktop environment.

关闭Firefox时不询问是否保存标签

根据Mozilla Support

  1. 打开about:config
  2. 修改browser.warnOnQuittrue
  3. 修改browser.showQuitWarningtrue.

Firefox 界面字体很难看

如果菜单栏的字体很难看,可能是因为 Firefox 找不到好看的字体,请先通过xorg-fonts-type1软件包安装 Type 1 字体。

Firefox 在某些网页中字体很难看

某些网页的点阵字体显示效果比较差,可以禁用 X 的点阵字体:

$ sudo ln -s /etc/fonts/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d/

从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 context menu does not appear on some sites

In about:config, unset the dom.w3c_touch_events.enabled setting.

Firefox does not remember default spell check language

The default spell checking language can be set as follows:

  1. Type about:config in the address bar.
  2. Set spellchecker.dictionary to your language of choice, for instance en_GB.
  3. Notice that the for dictionaries installed as a Firefox plugin the notation is en-GB, and for hunspell dictionaries the notation is en_GB.

When you only have system wide dictionaries installed with hunspell, Firefox might not remember your default dictionary language settings. This can be fixed by having at least one dictionary installed as a Firefox plugin. Notice that now you will also have a tab Dictionaries in add-ons.

Related questions on the StackExchange platform: [2], [3], [4]

Related bug reports: Bugzilla 776028, Ubuntu bug 1026869

Some MathML symbols are missing

You need some Math fonts, namely Latin Modern Math and STIX (see this MDN page: [5]), to display MathML correctly.

In Arch Linux, these fonts are provided by texlive-core and texlive-fontsextra, but they are not available to fontconfig by default. See TeX Live#Fonts for details. You can also try other Math fonts.

Picture flickers while scrolling

Note: Problem available in some MATE desktops

Uncheck the "smooth scrolling" settings:

Edit > Settings > Advanced > General > Use smooth scrolling

Tearing video in fullscreen mode

If you are using the Xorg Intel or Nouveau drivers and experience tearing video in fullscreen mode, try Firefox tweaks#Enable OpenGL Off-Main-Thread Compositing (OMTC).

Firefox looks bad with GTK+ >=3.20

Firefox (as of version 47) does not support GTK+ >=3.20 and may look unsightly as a result. A possible resolution is compiling Firefox against GTK2 instead, see firefox-gtk2AUR. Alternatively, you may use markzz's repository for pre-built GTK2 Firefox packages.

参见