Category Archives: Tutorials

Tutorials for a variety of subject matter

Firefox Add-Ons Puzzle

Firefox Tweaks and Fixes and Things

Introduction

Following is a collection of tweaks and fixes for the Mozilla Firefox web browser and its derivatives, such as Waterfox. Keep an eye out for changes as more stuff will be added in the future.

user.js: Changing how Firefox works

In order to properly change and save preferences for Firefox, you need to know how to create and edit a user.js file if you haven’t already got one.

Enable silky smooth scrolling

By default, scrolling with a mouse wheel in Firefox sucks. The following preferences, of which only one is available from the preferences UI, will greatly improve how scrolling with a mouse wheel and keyboard works. Scrolling will become silky smooth and respond dynamically to the speed at which you rotate your scroll wheel. This tweak will also enable smooth scrolling when a page is scrolled with the up/down arrow keys or the page up/down keys. By incorporating this tweak you be able to read text even while it is being slowly scrolled. Although this tweak is hugely beneficial either way, you will get the most out of it if hardware acceleration is enabled in the Firefox options.

There are at least a few extensions that are built to customize scroll operations and of them i have used both Yet Another Smooth Scrolling and SmoothWheel (discontinued). Both are similar and both work well, however i decided to dig into the Firefox preferences and discover if i could duplicate this behavior without an extension and it was actually easy to do, though it may take some fiddling to get the scrolling behavior set up exactly as you want it.

Following are the preferences that we will mess with and a description of what they affect. The suggested values seem to offer a good starting point. Note that “ms” stands for milliseconds (there are 1000 milliseconds in a second).

preference nametypedefault valuesuggested valuedescription
general.smoothScrollbooleantruetrueenable/disable smooth scrolling – this is the only option available in the Firefox Preferences UI
general.smoothScroll.linesbooleantruetrueenable/disable smooth line scrolling (up/down arrow/page keys)
general.smoothScroll.lines.durationMaxMSinteger150400maximum time in ms for which to smooth out the start/end of line scrolling operations with the up/down arrow or up/down page keys
general.smoothScroll.lines.durationMinMSinteger150200minimum time in ms for which to smooth out the start/end of line scrolling operations with the up/down arrow or up/down page keys
general.smoothScroll.mouseWheelbooleantruetrueenables smooth scrolling with the mouse wheel
general.smoothScroll.mouseWheel.durationMaxMSinteger400600smooths the beginning and end of scrolling operations (value is milliseconds)
general.smoothScroll.mouseWheel.durationMinMSinteger200300smooths the beginning and end of scrolling operations (value is milliseconds)
mousewheel.acceleration.factorinteger1010sets the wheel acceleration factor if mousewheel.acceleration.start > -1
mousewheel.acceleration.startinteger-10when to apply mousewheel.acceleration.factor (after how many scroll clicks of the mouse wheel)
mousewheel.default.delta_multiplier_yinteger10085sets the vertical step size, or how far a page will scroll with one scroll click of the mouse wheel
general.smoothScroll.otherbooleantruetrueenable/disable other smooth scrolling (Home/End keys)
general.smoothScroll.other.durationMaxMSinteger150400smooth out the start/end of other scrolling operations in ms
general.smoothScroll.other.durationMinMSinteger150200smooth out the start/end of other scrolling operations in ms
general.smoothScroll.pagesbooleantruetrueenable/disable page smooth scrolling (PgUp/PgDn keys)
general.smoothScroll.pages.durationMaxMSinteger150400smooth out the start/end of page scrolling operations in ms (PgUp/PgDn keys)
general.smoothScroll.pages.durationMinMSinteger150200smooth out the start/end of page scrolling operations in ms (PgUp/PgDn keys)

You can copy the code below and paste it directly into your user.js file:

/* smooth scrolling */
user_pref("general.smoothScroll", true);                            // enable/disable smooth scrolling
user_pref("general.smoothScroll.lines", true);                      // enable/disable smooth line scrolling (up/down arrow/page keys)
user_pref("general.smoothScroll.lines.durationMaxMS", 400);         // smooth the start/end of line scrolling operations in ms (up/down arrow/page keys)
user_pref("general.smoothScroll.lines.durationMinMS", 200);         // smooth the start/end of line scrolling operations in ms (up/down arrow/page keys)
user_pref("general.smoothScroll.mouseWheel", true);                 // enable/disable smooth scrolling with mouse wheel
user_pref("general.smoothScroll.mouseWheel.durationMaxMS", 600);    // smooth the start/end of scrolling operations in ms
user_pref("general.smoothScroll.mouseWheel.durationMinMS", 300);    // smooth the start/end of scrolling operations in ms
user_pref("general.smoothScroll.other", true);                      // enable/disable other smooth scrolling (Home/End keys)
user_pref("general.smoothScroll.other.durationMaxMS", 400);         // smooth the start/end of other scrolling operations in ms
user_pref("general.smoothScroll.other.durationMinMS", 200);         // smooth the start/end of other scrolling operations in ms
user_pref("general.smoothScroll.pages", true);                      // enable/disable page smooth scrolling (PgUp/PgDn keys)
user_pref("general.smoothScroll.pages.durationMaxMS", 400);         // smooth the start/end of page scrolling operations in ms (PgUp/PgDn keys)
user_pref("general.smoothScroll.pages.durationMinMS", 200);         // smooth the start/end of page scrolling operations in ms (PgUp/PgDn keys)
user_pref("mousewheel.acceleration.factor", 10);                    // sets acceleration factor if mouse wheel.acceleration.start > -1
user_pref("mousewheel.acceleration.start", 0);                      // when to apply mouse wheel.acceleration.factor (after how many scroll clicks of mouse wheel) - value must be greater than -1
user_pref("mousewheel.default.delta_multiplier_y", 85);             // sets the vertical step size
user_pref("mousewheel.min_line_scroll_amount", 10);                 // if the CSS line height is smaller than this value in pixels, each scroll click will scroll this amount

userChrome.css: Changing how Firefox looks

For customizing the browser interface, you will need to know how to create and edit a userChrome.css file if you haven’t already got one. If you need help with CSS selectors and what parameters they can take, see the CSS Introduction and CSS Reference documents at w3schools.com.

If you’re using Classic Theme Restorer, some of this code may interfere with options in CTR and so you should disable those options in CTR which correspond to the items below if you want to use my code instead. Classic Theme Restorer is a great source for popular and well written CSS code for customizing Firefox. Just download the package and extract it and you’ll find all sorts of goodies.

Move the Status Panel to the top and style it

The Status Panel is the pop-up text you see in the bottom left/right of the browser when you hover over a link. It also displays some information about the page loading process. As i recall, the link target text used to be located in the location bar before the Australis theme changed all that. I’ve always hated that annoying pop-up text appearing at the bottom of the view port (the part of the browser that displays the web page) and so i changed its appearance and location.

The CSS below will move the Status Panel to the top of the view port, make it span the full width, make it appear semi-transparent with a black background and white text and change some other attributes. You can customize it to your liking. At the very least you will probably have to change the pixel setting in the top property to get the Status Panel to appear where you want it vertically. If you like the appearance of the Status Panel but prefer to keep it on the bottom of the view port, just delete the line beginning with top:.

/* move status panel to top and style it */
statuspanel {
    top: 76px !important; /* distance from top of browser, not from top of viewport */
    z-index: 999 !important;
    width: 100% !important;
    box-shadow: none !important;
    border-bottom: 1px solid rgba(182,182,182,1.0) !important;
}
.statuspanel-label {
    background-color: rgba(0,0,0,0.5) !important;
    color: white !important;
    font-size: 13px !important;
    font-family:"DejaVu Sans Mono";
    width: 100% !important;
    margin: 0 !important;
}
/*
 * uncomment the below code (remove the first /* and the last */) if you want to change font and background colors for different status individually
*/
/*
statuspanel[type="overLink"] .statuspanel-label {
    background-color: rgba(255,255,255,0.85) !important;
    color: darkblue !important;
}
statuspanel[type="status"] .statuspanel-label[value^="Looking"] {
    background-color: rgba(0,0,0,0.5) !important;
    color: white !important;
}
statuspanel[type="status"] .statuspanel-label[value^="Connect"] {
    background-color: rgba(0,0,0,0.5) !important;
    color: white !important;
}
statuspanel[type="status"] .statuspanel-label[value^="Waiting"] {
    background-color: rgba(0,0,0,0.5) !important;
    color: white !important;
}
statuspanel[type="status"] .statuspanel-label[value^="Transfer"] {
    background-color: rgba(0,0,0,0.5) !important;
    color: white !important;
}
*/

Reduce navigation bar icon spacing

Reduce the horizontal space between the icons on the Navigation Bar. Adjust the -3 parameters to your liking.

/* reduce spacing between navigation bar icons */
@-moz-document url("chrome://browser/content/browser.xul") {
    #nav-bar toolbarbutton {
        margin-left: -3px !important;
        margin-right: -3px !important;
    }
}

Remove “Get Add-Ons” menu item from the add-ons panel

/* remove the Get Add-Ons button in the sidebar */
@-moz-document url("about:addons") {
    #category-discover {
      display: none !important;
    }
}

Adjust vertical space between the bookmark items

This will reduce the vertical space between your bookmarks in the sidebar, but you could also increase the space if you want.

/* adjust spacing between bookmark menu items */
.sidebar-placesTree treechildren::-moz-tree-row {
    height: 1.2em !important;
    border-width: 1px !important;
}

Remove the “Get Add-Ons” button in the add-ons sidebar

/* remove the Get Add-Ons button in the sidebar */
@-moz-document url("about:addons") {
    #category-discover {
      display: none !important;
    }
}

Add-On: Sidebar List

If you happen to be using the Sidebar List add-on, you’ll find that the minimum width that can be set for the sidebar switch is 1 pixel. If you set it to 0, the switch simply won’t work. I didn’t want to see the switch at all, but i wanted it to work when i clicked on it. Here’s how to do it (credit goes to ‘Infocatcher‘, the developer of Sidebar List):

/* Add-On: Sidebar List - hide the sidebar switch */
#sidebarsList-splitter {
    opacity: 0;
    min-width: 1px !important;
    margin-right: -1px !important; /* Should be the same as "min-width" */
}

userContent.css: Changing how websites look

For customizing the appearance of a website, you will need to know how to create and edit a userContent.css file if you haven’t already got one.

Override text selection/copying for sites that prevent it

In an arcane effort to prevent copying text, some websites will try to stop you from selecting it. Add this to your userContent.css file to solve the problem:

/* override CSS preventing text selection */
* {
    -moz-user-select: text !important;
    user-select: text !important
}

Hide the Sync tab in Firefox Preferences

Don’t use Sync? Here’s how to hide the Sync tab in the Firefox Preferences UI:

/* hide Sync tab in Preferences */
@-moz-document url("about:preferences") {
    #category-sync { display: none !important; }
}

Fixes: Possible solutions for stuff that’s broken

Firefox doesn’t remember its window size after restarting

If you maximize the Firefox window, then close and reopen it, it may not open in a maximized state. The problem can be caused when the preference privacy.resistFingerprinting is set to true. In this state, this preference does a number of things to make it harder for websites to fingerprint your browser and one of them is to set a generic viewport size. You can follow these steps to solve the problem, but know that when you deviate from a generic viewport size, your browser may be slightly easier to fingerprint. The following is specific to Linux with the KDE desktop, but you might find this information useful in other circumstances:

  1. Start Firefox and enter about:config in the address bar
  2. Check the value of privacy.resistFingerprinting. If it is set to true, leave it be and continue, if it is set to false, sorry, i can’t help you, but you should consider setting it to true.
  3. If you are running a Linux distribution with the KDE desktop, open the System Setting applet and then click the Window Management icon, then Window Rules. If you are not running KDE or are running a different operating system altogether, you should be able to find a utility somewhere that will allow you to set rules for program windows. Basically you want a utility that will force the Firefox window to start in a maximized state. You can then look at the remaining steps to get an idea of what we’re doing here and adapt as necessary.
  4. With Firefox running, click the New button to create a new window rule.
  5. In the Edit Window Specific Settings window, enter the following for Description: Firefox.
  6. Click the Detect Window Properties button and then click anywhere in the Firefox window.
  7. In the dialog that opens, check the Window role and Window type boxes and then click OK.
  8. Switch to the Size & Position tab and set both Maximized horizontally and Maximized vertically to Apply initially and make sure both are enabled (set to Yes).
  9. Click OK to exit back to the Window Rules window, then click Apply and close the window.
  10. Restart Firefox to test if the fix worked. If it doesn’t, let me know in the comments.

Disappearing tool-bar and Start Panel icons

In the address bar, enter about:config and press Enter, then in the search box enter extensions.databaseSchema and, lastly, right-click this preference and click Reset. Restart Firefox.

Removing the Firefox title bar on Linux KDE – alternative methods

One of the issues i had when i scrapped Windows and installed Linux Mint was that i missed how easy it was to hide the Firefox window title bar in order to gain that extra bit of vertical real estate under Windows. With Mint and the KDE desktop environment i found several options to accomplish a similar result, but i liked none of them and so off i went seeking a better alternative.

Most of the the options i found either advised to install the Hide Caption Titlebar Plus extension for Firefox, which works on Linux, more or less, or to apply a custom window style using the Window Actions and Behavior settings in KDE (System Settings > Workspace > Window Management on Mint 18.x). The problem with the former is that it is hugely bloated with options i don’t use nor want and it didn’t produce a very nice looking result, plus i prefer to do things without installing more Firefox extensions when possible. The problem with the latter option is that, while it is indeed trivial to remove the Firefox window title bar using the Window Management tool provided by KDE, this left me with a borderless window that couldn’t be resized when it wasn’t maximized.

By accident i stumbled upon what i personally think is a better solution while playing with the KDE Window Decorations utility in System Settings > Appearance > Application Style > Window Decorations settings and no additional software or configuration tweaks were needed.

System Settings - Application Style
click to enlarge

On the Theme tab of the Window Decorations utility, you’ll see the previews of whatever window themes you have installed. In Mint 17.x/18.x with KDE, i think the defaults are Breeze and Plastik.

Window Decorations - Theme
click to enlarge

For this to work, you have to be using the Breeze theme or another one that supports windows-specific overrides (the Plastik theme does not, nor do any of the custom themes i tried). Using Breeze as the example, if you click on the little tool icon on the lower-left of the theme preview, you’ll get a menu which opens the settings for the theme.

Window Decorations - Theme Settings
click to enlarge

On the Windows-Specific Overrides tab you can add a couple of window specific styles for a given window, or even all windows if you want. The only two options are to change the border size and hide the title bar. These options are not nearly as comprehensive as those found in the System Settings > Workspace > Windows Management > Window Rules utility, but the difference between the two is that, as previously mentioned, you lose the window border and thus the ability to resize the window with the mouse when removing the title bar using the Window Rules utility, while you retain the window border when using the Windows Decorations utility.

So to accomplish what we want, simply click that little tool icon on the window theme preview and switch to the Windows-Specific Overrides tab. From here, click Add and a utility to identify the window for which you want to remove the title bar will be displayed.

Breeze System Settings - Add

In this window you have two options; you can either set the Matching window property to Window Title or Window Class Name. I recommend you select the Window Class Name option (if you don’t, you’ll eventually figure out why i recommend this option). In the Regular expression to match field, enter Navigator Firefox (in the image below i use Navigator Waterfox because i use Waterfox). In the next section you can enable or disable the window border size option if you want, but most importantly you’ll want to select the Hide window title bar option, then click “OK” and “Apply” and you’re done with this part.

KDE: Window-Specific Overrides

The caveat with this method verses using an extension, is that we lose our browser window exit, restore and minimize window controls and so you’ll have to get used to exiting Firefox using another method such as a keyboard shortcut or a menu item, but what i prefer is to simply middle-click the task bar icon to close windows. This is easily accomplished by right-clicking any task bar icon and selecting the Task Manager Settings menu item, then setting the On middle-click option in the General section to “Close Window or Group”. Note that i personally do not group windows.

Task Manager Settings - Plasma
click to enlarge

Returning to Firefox, you may still have a bit of a problem in that you will need a way to drag the window so we can restore (un-maximize) it, resize it and move it around since our title bar is now gone. My solution was to simply add a bit of fixed space to the end of the tab bar (i set tabs to be on top). This is really only needed when you have enough tabs open so as to fill the space on the tab bar. I suppose there are a couple of ways to accomplish this, including a userChrome.css hack, however the easiest way is to put the browser in customize mode and drag one or more fixed-width spaces to wherever you want on the tab bar.

Mozilla Firefox - Add Static Space
click to enlarge

So hopefully you now have an easy way to exit, move and resize Firefox, along with a bit more screen real estate, and it can all be done without having to edit a single configuration file.

More Firefox stuff

Other articles and tutorials i’ve written regarding Firefox and its derivatives:

So you’re looking to make a small splash in the cryptocurrency pool? Try this…

I wanted to finally get in on the cryptocurrency ‘thing’ and so i started poking around and found several guides that discussed how to buy a cryptocurrency, primarily Bitcoin. One of the better guides i found is 101+ Best Ways to Buy Bitcoins Online in 2017. After spending a lot of time looking at these coin brokers and reviewing their “privacy” policies and what personal information they required, i got rather disgusted with the whole thing. And then i thought about another approach…

Why not just find a private party that has the cryptocurrency i wanted and offer to trade for dollars? And so i emailed one of my favorite independent journalists/analysts and said “hey, if i donate $60 to you, will you send me $50 in Bitcoin and you can keep the $10?”. For me this was a win-win-win thing because the $10 went toward a worthy cause instead of some cryptocurrency broker and i got my coin and i didn’t have to create any website accounts or give up any personal information.

So if you’re looking to make a small splash in the cryptocurrency pool, you might want to try my method.

Good luck!

New tut: Firefox Search Engine Cautions and Recommendations

A new tutorial has been published titled Firefox Search Engine Cautions and Recommendations which covers the risks to your privacy when using any of the major search engines in general, but specifically when using the default search engine plugins that are packaged with the Firefox web browser, though this problem is certainly not limited to Firefox. I also cover how to circumvent the risks to your privacy when using the default Firefox search engine plugins, as well as make suggestions for alternative search engines.

I have to say that i’m becoming more and more disillusioned with the multi-million dollar Mozilla corporation and its flagship product, Firefox. Firefox was never a great web browser in my opinion, but it is/was appealing to many because of how completely customizable it is. In it’s earlier days it was just a little slow and buggy, but more recently Mozilla is making highly unethical choices with regard to the privacy-hating corporations they willingly partner with and how these partnerships have manifested and have been monetized in Firefox is a result of utter stupidity and greed in my opinion. I stuck with Firefox all these years because it has always been one of the most hackable browsers out there, but these days i stick with it primarily because i’m not (yet) able to reproduce the functionality i have added to it via add-ons with any other browser, and Chrome is out of the question, much less Google’s spyware version of it.

It’s sad and frustrating that a company who produced a decent, super-highly customizable browser for a niche market has lost its way and turned its back on the very market it once served by deciding to become a Google Chrome clone in order to appeal to the masses.

Screw you Mozilla.

But let’s end on a lighter note, shall we? Here, have a look.

Tutorial

Firefox Search Engine Cautions, Recommendations

See the revision history at the end for a list of changes to this document.

Introduction

The scope of this tutorial is limited primarily to preserving your privacy when using the default Firefox (or derivative thereof) search engine plugins, as well as discovering new search engines and finding alternative ways to use the major search indexes, such as Google, Bing and Yahoo. For a more in-depth tutorial regarding Firefox privacy issues and customization, please see the article, Firefox Configuration Guide for Privacy Freaks and Performance Buffs.

When ‘Free’ software isn’t

Many of us probably tend to associate the open-source software community with individuals or small organizations that freely give away their work and expect little or nothing in return, however nothing could be further from the truth regarding the multi-million dollar Mozilla Foundation. The hundreds of millions of dollars that Mozilla rakes in annually is largely due to its partnership with search engine companies such as Google, Yahoo and others. These ethically challenged mega-corporations then track your web activities and sell the data they collect to advertisers and governments and who knows who else. It seems to me that these kinds of partnerships are clearly at odds with Mozilla’s statement, “Committed to you, your privacy and an open Web“.

So how does Mozilla get paid by the mega-giants like Yahoo and Google? Simple: Any time you use any of the default search engine plugins that are packaged with the browser, parameters like these are added to your search query:

client=firefox-a
name="appid" value="ffd"
name="hspart" value="mozilla"

These parameters tell the search engine that you are using a Firefox/Mozilla product and that’s all it takes to rake in the dough. If you do not wish to participate in these affiliate schemes and/or value your privacy, read on.

Types of search engines

It appears the two basic types of search engines are meta search engines and search indexes and it is important to understand the difference. Google, Yahoo and Bing for example, use software robots known as “crawlers” to discover and index web content. In other words these companies actively seek out updated and fresh content to store in their databases so that it’s ready for you to find. Meta search engines do not typically index the web however and instead rely primarily on third parties like Google, Yahoo and Bing to provide their search results and therefore when you use so-called “alternative” search engine such as DuckDuckGo, Startpage, Searx, etc., you are still subject to the content manipulation and censorship employed by the big corporations. While these alternative meta search engines do indeed make a great deal of sense from a privacy perspective since one can avoid being tracked by the big indexes directly, they are not true alternatives as they are often described, but more like search engine proxies which simply provide their own interface in order to display the search results as provided by third parties. These alternative search engines are also subject to local laws, such as secret surveillance requests issued by a government.

Indexing the web and storing the massive amount of data that results is an incredibly expensive proposition and this is why meta-search companies like DuckDuckGo, Startpage, Searx and others rely heavily upon corporations like Google. There is an even better solution however, one which both respects your privacy and is censorship resistant and these are distributed search indexes. Imagine a free, open-source, decentralized search engine where the search index is distributed among millions of personal computers like yours, each storing a piece of the whole. This is what the developers behind YaCy have done with their peer-to-peer search engine and i think it’s a great way to move forward and avoid corporate censorship and attacks on personal privacy.

Adding search engines to Firefox

Possibly the easiest way to mitigate risks to your anonymity posed by using the default Firefox search engines is to simply disable all of them and find alternatives. One of my favorite choices is the open source and highly configurable Searx meta search engine which you can host on your own web server if you wish, but you certainly don’t have to in order to use it. Like DuckDuckGo, Startpage and others, Searx is not an index and so it does not crawl the web seeking out and storing content like Google does. The primary difference between Searx and most of the other meta search engines however, is that Searx is capable of pulling results from many other indexes, including decentralized peer-to-peer indexes such as Faroo, as well as centralized indexes like Google Yahoo and Bing, any of which you can enable or disable using the excellent preferences interface that Searx provides.

One easy way to add Searx to Firefox is to locate a hosted instance which you like and which is preferably close to you geographically, and then from the Firefox search bar, simply click the “add” menu item. While searx.me is the original instance of Searx as provided by the developers, it is best not to use it because it can become overloaded. The Searx developers simply cannot afford to have too many people using their particular instance without your help and so they will disable it at times in order to promote the many other third party instances. That said, a potential pitfall to using a third party Searx instance is that the server may be logging traffic, such as IP addresses, countries of origin, etc., so you’ll have to decide what’s best for you.

Most other search engines can be added to Firefox in the same way as described above, but there are other ways also. The Mycroft Project hosts tens of thousands of preconfigured search engine plugins for a variety of web browsers and they  have a form for writing your own plugins which can then be added by simply by clicking on their names, the top 100 of which are listed here. Unfortunately it is not possible to review the code from the main listing of search plugins before adding it to your browser, however you can use their submission form to do so by mousing over the plugin name to reveal its numeric ID and then filling in that ID in the submission form page.

Privacy-centric search engines

For a list of search engines that focus on privacy, see the article, Alternative Search Engines That Respect Your Privacy.

Sanitizing the default search engine plugins

If you choose to use the default search engine plugins provided by Mozilla, you may want to sanitize them in order to circumvent some risks to your privacy, however you should be aware that sanitizing the default plugins will not prevent tracking or privacy risks when clicking on the search results provided by those companies. If you are going to use the default search engine plugins, then you should also use something like the Neat URL add-on which at least strips the tracking parameters from URLs.

If you are running Firefox version 56 or less and want to sanitize the default search engine plugins yourself, you might want to install the XML Search Engines Exporter/Importer add-on which makes it super easy to export and import the modified plugin code wherein we will be removing the monetization schemes and browser fingerprinting employed by Mozilla. You will also want a decent code editor, such as Kate for Linux (already included in some distributions) or Notepad++ or PSPad for Windows. If you do not want to sanitize the default search engine plugins yourself, you can download my pre-sanitized plugins below (what search engine plugins ship with Firefox depends on your language and i have sanitized only the U.S. English ones).

From Firefox version 57 and newer, Mozilla has dropped support for importing search engine plugins from the /searchplugins folder in your profile directory and so another method is needed. Though the XML Search Engines Exporter/Importer add-on will not work in v57+, the developer, ‘nohamelin’, has kindly made available two Scratchpad scripts on his GitHub page which include instructions for exporting and importing search engine plugins. They are xseei.export-all.js and xseei.import.js. You can use the import script to import your manually sanitized search plugins, or you can import my pre-sanitized search plugins below.

Installing pre-sanitized search plugins

If you would rather avoid the hassle of sanitizing the default search plugins manually, you can use my pre-sanitized plugins which are from the U.S. English version of Firefox and include Amazon, Bing, DuckDuckGo, Google, Startpage, Twitter, Wikipedia and Yahoo. Each will have an “(s)” appended to its name in your search bar and search preferences to indicate it has been sanitized. Note that you should still sanitize the prefs.js preferences corresponding to these search plugins as described below.

In all cases the search suggestion code has been removed and _s was appended to the XML file names. In the case of Google it has been further customized to disable safe search, auto-complete, personalized search and other annoyances. Google has also been configured to use only google.com, thus disabling the automatic country redirect (in other words if you live in Canada and want to use google.com, Google will no longer redirect to google.ca) and both the displayed name and file name include “NCR” which stands for “No Country Redirect”.

Download: sanitized-searchplugins.zip

Sanitizing manually

If you are using the XML Search Engines Exporter/Importer add-on for Firefox version 56 or less, open the Firefox preferences UI and navigate to the “Search” section, or enter about:preferences#search in the address bar. You should probably make sure that all of the search engines are enabled at this point, even those you don’t use, else you will not be able to edit them. Click the “Restore Default Search Engines” button if necessary. Near the bottom of the search preferences UI you will notice some new buttons, but the one we are interested in is labeled “Export All Search Engines to File…”. This will export all of the default search engine plugins, as well as any others you may have added, to a ZIP archive, the extraction of which will reveal a bunch of XML files and it is these which we will be editing.

If you are using the Scratchpad scripts by ‘nohamelin’, follow the instructions in the script comments to export the search plugins.

The following uses the yahoo.xml file as an example (note that the base64 image code for the Yahoo icon was removed ( [icon code removed] ) to shorten the example, but it will be present in your file):

<?xml version="1.0" encoding="UTF-8"?>
<Searchlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
  <os:ShortName>Yahoo</os:ShortName>
  <os:Description>Yahoo Search</os:Description>
  <os:InputEncoding>UTF-8</os:InputEncoding>
  <os:Image width="16" height="16">data:image/x-icon;base64,[icon code removed]</os:Image>
  <SearchForm>https://search.yahoo.com/yhs/search?p=&ei=UTF-8&hspart=mozilla&hsimp=yhs-001</SearchForm>
  <os:Url type="application/x-suggestions+json" method="GET" template="https://search.yahoo.com/sugg/ff" resultDomain="search.yahoo.com">
    <os:Param name="output" value="fxjson"/>
    <os:Param name="appid" value="ffd"/>
    <os:Param name="command" value="{searchTerms}"/>
  </os:Url>
  <os:Url type="text/html" method="GET" template="https://search.yahoo.com/yhs/search" rel="searchform" resultDomain="yahoo.com">
    <os:Param name="p" value="{searchTerms}"/>
    <os:Param name="ei" value="UTF-8"/>
    <os:Param name="hspart" value="mozilla"/>
    <!--The original definition of this search engine included too some non-standard 'MozParam' parameters. As they are recognized by Firefox only if they are found in an engine included by default in the application, they were omitted here.-->
  </os:Url>
</SearchPlugin>

Examining the above code reveals added parameters that are not necessary for performing a search with Yahoo. Following are the parameters which we want to edit:

In the <SearchForm> tag, everything after /search in the URL, beginning with the question mark, can be removed so we end up with the following:

<SearchForm>https://search.yahoo.com/yhs/search</SearchForm>

The entire block beginning with <os:Url type="application/x-suggestions+json" and ending with the first of the two </os:Url> closing tags can be removed. This will disable some fingerprinting as well as search suggestions.

The line <os:Param name="hspart" value="mozilla"/> can be removed.

The last thing you must to do is rename the search engine since the XML Search Engines Exporter/Importer add-on will not import a search engine plugin with the same name as a default plugin included with Firefox. This will also allow you to be sure you are using the sanitized version of Yahoo rather than the default one as provided by Mozilla since the modified name will be the one displayed in your search bar and in your search preferences. To rename the plugin, simply edit the following line and change Yahoo to whatever you wish:

<os:ShortName>Yahoo</os:ShortName>

I might suggest something like this, where the (s) stands for “sanitized”:

<os:ShortName>Yahoo (s)</os:ShortName>

The above is how the Yahoo search engine will be displayed in your search bar and in the Firefox preferences.

The name of the XML file does not have to be changed, but you may want to append something like _s to it to indicate it has been sanitized so you don’t get it mixed up with the default search plugin.

For the remaining search engine plugins you basically want to repeat what we have done above with Yahoo. The parameter names and values will sometimes differ from the examples above, but basically you want to look for anything that identifies your browser, operating system and, potentially, your local and remove it. For example, if you exported the Wikipedia search plugin XML file, you will find in it &amp;sourceid=Mozilla-search and <os:Param name="sourceid" value="Mozilla-search"/>, both of which can be removed. The exception with all of the search plugin XML files is that you do not need to alter the <SearchPlugin xmlns= line even though it may contain a mozilla.org URL.

To import the sanitized search engine files with the XML Search Engines Exporter/Importer add-on (FF v56 or less):

  1. Start Firefox, open the search preferences UI (about:preferences#search) and import your sanitized search plugins. Optionally you may want to disable/remove the default search plugins.

To import the sanitized search engine files manually (FF v56 or less):

  1. Place your sanitized search plugin XML files in the /searchplugins folder within your Firefox profile folder (create the folder if necessary).
  2. In your Firefox profile folder, rename the search.json.mozlz4 file to search.json.mozlz4.bak.
  3. Restart Firefox and, optionally, open the search settings in the preferences UI (about:preferences#search) and disable/remove the default search plugins.

To import the sanitized search engine files using the Scratchpad script by ‘nohamelin’ (FF v57 or greater):

Simply follow the instructions in his script.

Sanitizing the prefs.js search engine preferences

Another step we need to perform is to sanitize any browser.search.param. preferences in the prefs.js file. To do this it is best to create a custom user.js file to store our modified preferences if you don’t already have one. You can read the tutorial, Firefox Configuration Guide for Privacy Freaks and Performance Buffs, for information on creating the file, as well as many additional things we can do to protect our privacy and tighten the security of Firefox.

To sanitize the search engine preferences, open the about:config URL in your browser and enter browser.search.param. in the search field. At the time of this writing there are only two preferences that will be displayed and they are browser.search.param.yahoo-fr and browser.search.param.yahoo-fr-ja. The default values may be different in your case, but in mine they are data:text/plain,browser.search.param.yahoo-fr=linuxmint and an empty string, respectively. What you need to do is copy both preference names to your user.js file and set the values to an empty string:

user_pref("browser.search.param.yahoo-fr", ""); // sanitize Yahoo
user_pref("browser.search.param.yahoo-fr-ja", ""); // sanitize Yahoo

If you are going to sanitize the other default search engine XML files, you may as well sanitize any other prefs.js preferences related to the other search engines as we did above. Simply enter browser.search.param. in the search field and copy all the preference names to your user.js file and set the empty the values as shown above (again, at the time of this writing, the only two preference names refer to Yahoo).

Removing the ‘Follow On Search’ system add-on

Mozilla packages some system add-ons (browser extensions) with Firefox and installs them without your permission and these system add-ons are not listed in the Extensions section of the Preferences UI (about:addons). The technology behind one of these system add-ons is called “Follow-on Search” (also see the Mozilla GitHub repository page) and it is used to collect data about the way you use the Google, Bing and Yahoo search engines. Note that this add-on works independently of the search engine plugins discussed in this article and therefore it too must be addressed if we value our privacy.

To see if the Follow-on Search add-on is installed, open about:support in the Firefox address bar and look under the section titled “Firefox Features”. In my particular case under Linux Mint, there was no “Firefox Features” section on the support page, nor was the add-on found on my system, however there were other system add-ons found.

The Follow On Search add-on, which has the file name followonsearch@mozilla.com.xpi, is located at /usr/lib/firefox/browser/features on Linux Mint (and very likely other flavors of Linux as well) and at \Program Files (x86)\Firefox\browser\features or \Program Files\Firefox\browser\features on Windows and i would suggest either deleting or disabling it. Under Linux, i am not aware of how it can be disabled, but it can certainly be deleted. Here’s how delete all of the system add-ons under Linux:

cd /usr/lib/firefox/browser/features
sudo rm *.xpi

On Windows you can apparently use CCleaner to disable these system add-ons from the Tools > Browser Plugins menu.

Note that these system add-on files will be recreated when Firefox is updated and therefore you will need to delete/disable them after each update. On Windows, CCleaner may keep these add-ons disabled after a Firefox update but you should check to be sure. To avoid this hassle, i suggest using a privacy-centric custom build of Firefox, such as Waterfox, which does not support system add-ons.

We’ve only scratched the surface…

Sanitizing the Firefox search engine plugins is a good start, but there is much more to do if you’re interested in circumventing the risks to your privacy and computer security that are inherent in any of the popular web browsers. For further information, please refer to my article, Firefox Configuration Guide for Privacy Freaks and Performance Buffs. You may find it helpful even if you aren’t using Firefox.

Resources

Special mention goes to ‘Thorin-Oakenpants’ (aka ‘Pants’) as well as the ‘ghacks’ crew and their GitHub repository where they host an excellent privacy and security centric custom user.js for Firefox, as well as a Wiki which is full of valuable information.

Change log

Click to expand...

15-Sep-2017

  • first publish

16-Sep-2017

  • added this change log
  • corrected an error in the pre-sanitized Wikipedia search plugin and re-uploaded sanitized_search_plugs.zip
  • added information as suggested by ‘Pants’ in his comment below, particularly details and resources regarding the followonsearch@mozilla.com.xpi system add-on in a new section titled “Removing the ‘Follow On Search’ system add-on
  • added Hulbee and MetaGer to the search engine list
  • added a “Decentralized” column to the search engine table
  • added resource: 5 Best Search Engines That Respect Your Privacy – BestVPN.com
  • misc. cleanup and edits

17-Sep-2017

  • corrected typo in metager URL
  • added “Requires JS / Cookies” column in search engine table
  • changed links for search engines in table to point to company/about page and added links to point to search page
  • added link to the ‘lite’ version of DDG
  • added a link to the uBO filters to block Startpage/Ixquick tracking images
  • misc. minor edits

18-Sep-2017

  • added “Client Required” column to search engine table
  • corrected some info regarding the search engines in the table
  • minor misc. edits

24-Sep-2017

  • added a link to the Duck Duck Go: Illusion of Privacy article
  • added findx to the search engine list
  • minor edits

27-Sep-2017

  • added Qwant to the search engine table

29-Sep-2017

  • misc. edits and added info, nothing really important

3-Oct-2017

  • very minor edits

23-Oct-2017

  • moved the list of alternative search engines to it own page
  • minor edits

5-Dec-2017

  • minor change to the section ‘Sanitizing the default search engine plugins’ thanks to commenter ‘nohamelin’ – more changes coming shortly thanks to this persons comments

23-Dec-2017

  • updated search plugin import/export instructions as per the very helpful comment left by ‘nohamelin’, the developer of the XML Search Engines Exporter/Importer add-on in which he made available Scratchpad scripts that work with FF v57+
  • corrected an error in the pre-sanitized search engine archive, added Startpage and re-uploaded a new archive
  • misc. minor edits

28-Jan-2018

  • polishing