Firefox - Notes and tips about my favorite web browser !!!

mail

A company policy has disabled the Firefox Account button and I can not sync Firefox settings

Situation

For some unknown reason, a company policy has disabled the Firefox Account button. As a result, I can not :

Details

Solution

  1. Windows-r | regedit
  2. browse to the key : HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Mozilla\Firefox
    The "source" article linked below points to HKEY_CURRENT_USER\Software\Policies\Mozilla\Firefox but I had no such key .
  3. change the value of DisableFirefoxAccounts from 1 to 0
  4. no reboot required, just restart Firefox
  5. enjoy
mail

XSL not applied in Firefox, only displaying the XML data

Situation

Details

The built-in Developer Tools Console (F12) shows the error message :
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///path/to/my/stylesheet.xsl. (Reason: CORS request not http).
Starting with Firefox 68, resources loaded via file://... URLs all have a single distinct origin. A page (and its sub-elements) may not have multiple origins (due to CVE-2019-11730), which is why resources (here, the XSL stylesheet) are blocked.

Solution

  1. open the about:config page
  2. change the privacy.file_unique_origin key to false
mail

How to disable warnings about insecure login forms ?

  1. enter about:config mode
  2. toggle security.insecure_field_warning.contextual.enable to false
  3. toggle signon.autofillForms.http to true
mail

Firefox about: and tuning options

All the about: pages (source) :

Type ... in the address bar and access ....
about: browser, logo, version, etc.
about:about This is the only one worth mentioning
about:addons
about:buildconfig
about:cache the cache
about:config configuration options. Be careful while inside !
about:healthreport
about:license
about:logo The Firefox logo
about:memory memory usage
about:plugins installed plugins
about:robots Just robots
about:rights
about:support information to provide when requesting support

To speed up browsing :

  1. Enter the about:config mode
  2. Change network.dns.disableIPv6 to true
  3. Change network.http.pipelining to true
  4. Change network.http.pipelining.maxrequests to 32
  5. Change network.http.proxy.pipelining to true
  6. Create a new numeric value called nglayout.initialpaint.delay and set it to 0 (zero). This sets the browser's reaction delay when receiving data.
  7. Change browser.cache.use_new_backend to 1 (source)
  8. restart Firefox to apply changes

To reduce memory usage :

  1. Enter the about:config mode
  2. Create a new boolean value named config.trim_on_minimize and set it to true
  3. restart Firefox to apply changes
With this, Firefox will free some memory when minimized. When maximized after that, it will take again some memory space, but less than before.

Some interesting about:config options :

Option Suggested value Usage
browser.search.openintab true Open searches in a new tab
browser.download.lastDir Path to the latest directory in which a "Rclick | save as" was performed
(found in profile_directory/prefs.js)
full-screen-api.approval-required false Prevent Firefox from showing a dialog box saying that the page/content is displayed full screen
network.automatic-ntlm-auth.trusted-uris Comma separated list of websites on which to activate NTLM authentication
network.protocol-handler.app.mailto /usr/bin/thunderbird Path to the mail application to start when clicking on a "mailto" hyperlink
network.IDN_show_punycode true Display punycode instead of IDN
(How to handle IDN ?, IDN homograph attack)

Files found in the Firefox profile_directory (list) :

mail

Firefox profiles

Find the profiles directory (Source) :

Windows 2000 / XP
%APPDATA%\Mozilla\Firefox\Profiles\ (you may paste this in the file explorer)
Linux
~/.mozilla/firefox/xxxxxxxxxx.default/
Find it with :
find ~/.mozilla -type d -iname "*.default*"

This is the default profile.

There may be complex situations where this lists several xxxxxxxxxx.default directories. To find which profile is currently in use :
  1. Start Firefox
  2. Alt | Help | More Troubleshooting Information
  3. see the Profile Directory line

Create a new profile with the profile manager (Source) :

  • Windows :
    1. stop Firefox first
    2. Start | Run | firefox.exe -ProfileManager
    3. follow on-screen instructions

Launch another Firefox instance using a different profile (source) :

path/to/Firefox/binary -P profileName -no-remote
Windows
"C:\Program Files\Mozilla Firefox\firefox.exe" -P ExtDev -no-remote
Linux

"Install" extensions across profiles :

Just copy/move the matching directories from srcProfileDirectory/extensions to dstProfileDirectory/extensions.

Backup / restore a profile (source) :

Backup :

  1. Exit Firefox
  2. Find your profile directory
  3. Copy the whole xxxxxxxxxx.default (the directory itself, not just its contents) to a safe place
  4. That's it !

Restore :

There are several methods depending on whether it's a fresh install, a recovery, ... (details). The steps below apply to a fresh install (new Firefox, new PC).

  1. Exit Firefox
  2. Copy the whole contents of your profile backup xxxxxxxxxx.default/* (just its contents, not the directory itself now to your profile directory. You can overwrite existing files.
  3. Enjoy !
mail

How I circumvented the Firefox anchor bug

Situation

This refers to this bug : when clicking an hyperlink containing a document anchor leading to somewhere within the page (ie : http://www.example.com/page.html#anchor), Firefox ignores the anchor and displays the top of the page. After pressing F6 + , Firefox agrees to scroll down to the anchor.

Details

(Found details in an old bug report, and lost it. I just remember this behavior appeared with Firefox 4.0. Will post the link here should I encounter it someday)

Solution

Add to every target page containing anchors :
<script type="text/javascript">
	window.onload = function() {
		var currentLocation	= window.location.href;
		var positionOfHashSign	= currentLocation.indexOf('#')

		if(positionOfHashSign >= 0) {
			var targetAnchor	= currentLocation.substr(positionOfHashSign + 1);
			var anchorYPosition	= document.getElementById(targetAnchor).offsetTop;
			window.scrollTo(0, anchorYPosition);
			}
		}
</script>
mail

Advanced filtering with Firefox

Using uBlock Origin

The main differences between this method and the UserContent.css method below are :
  • content filtered by uBlock Origin is not downloaded.
  • uBlock Origin can not alter content that is built-in the HTML source code. It can only filter on files. On the contrary, UserContent.css with powerful selection rules can even alter the page source.

Using UserContent.css

UserContent.css is designed to be a local user-defined set of CSS preferences. But it can also be tweaked to mangle web content (such as ads) before it reaches your screen. It is not created during a standard installation, but creating it is fairly easy :
  1. go to your profile directory
  2. enter the chrome sub-directory and create the UserContent.css file.
  3. in this CSS file, you can now massively set some {display:none !important;} rules. To do so, consider reading CSS3 selector / attributes rules.
  4. may be you'd like some examples ?

It seems that UserContent.css is loaded only when Firefox is starting. Moreover, loading may fail if the file is still open for edition.

mail

Let Firefox open mailto: hyperlinks in your favorite mail processor

  1. Type about:config in Firefox address bar
  2. Browse to the property called network.protocol-handler.external.mailto and set it to true. If it doesn't exist, create it.
  3. Create a new property called network.protocol-handler.app.mailto and enter the path to your mail application. (For example : C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE).
  4. Close and restart Firefox to reload this option.
  5. Test it !