Firefox tips

Browser Keywords

Browser keywords might be the single most useful productivity tip I’ve incorporated into my workflows across any domain.

Basic usage

You can assign a short, custom keyword to any of your bookmarks. Typing the keyword into the address bar brings you to the bookmark’s URL.

Example:

  1. I bookmark the Microsoft Learn search page at URL https://learn.microsoft.com/en-us/search/?category=All
  2. I edit the bookmark and assign the keyword MSdocs
  3. In my browser navigation bar, I type MSdocs and press Enter
  4. My browser loads the Microsoft Learn search page.

This is useful for quickly accessing sites with long URLs, or sites where a selection of saved filters/parameters is encoded into the URL. Use short, related keywords to maximize memorability.

Parameter substitution

You can substitute text into a URL by using %s as a placeholder in the bookmark URL, then supply the substitution text when using the keyword.

Example:

  1. I search Google Maps for “Washington, DC”
  2. The URL returned looks like this: https://www.google.com/maps/place/Washington,+DC (truncated to simplest form)
  3. I bookmark the site, replacing Washington,+DC with %s and assigning keyword map
  4. In a new tab, I type map Tokyo, japan and press Enter
  5. My browser loads the Google Maps search result for Tokyo, Japan.

This significantly improves the flow of searching, jumping directly to returned results instead of the search landing page.

Some example services I use this for:

I have a total of 41 bookmarked URLs with substitution enabled!

Limits

Keywords with substition are great, but do have some limits.

The URL must depend on the search term

The service must provide a URL destination that depends on the provided search term. If it does some in-page scripting to load results and the URL never changes, this method won’t be effective.

Accidental keyword triggering

Keywords might be triggered accidentally when searches are intended for the default search engine. If I’m searching for HTML redirect and HTML is assigned to the Mozilla developer docs bookmark, the browser triggers the HTML keyword and passes redirect as the substitution parameter.

Use the built-in keyword ? at the beginning of an entry to force the search to the default search engine, eg ? html redirect

Keywords aren’t searchable

For some reason, assigned keywords aren’t searchable in the bookmarks browser. Searching for %s will reliably return your parameter substitution searches; otherwise, I recommend assigning tags to all bookmarks at time of creation. This is a good idea generally for searchability, context, and enabling auto-complete to return bookmarks based on a matched tag.

Cumbersome keyword/URL creation

The bookmark quick-entry dialog - accessed by pressing Ctrl+D or the star icon in the address bar - doesn’t include the keyword or URL fields.

You can access these by right-click the bookmark from the toolbar and choose “Edit Bookmark…”; or by opening the bookmark browser (Ctrl+Shift+O), browsing to the new bookmark, then editing.

See Enabling keyword assignment during initial creation for a more comprehensive solution.

Other tricks

Opening multiple URLs from one bookmark

Open several sites simultaneously with one bookmark using a javascript snippet. This javascript should be entered in the URL field:

javascript:window.open("url1","_self");window.open("url2","_blank");window.open("url3","_blank")

This will open the URL1 in the active tab; URL2 and URL3 will open in additional tabs.

Enabling keyword assignment during initial creation

You can force Firefox to show the URL and Keyword fields in the bookmark editor dialog when bookmarking a page with Ctrl+D or the blue star. This works by supplying a file that gives overriding CSS instructions to Firefox, which affects the display of internal components.

The instructions below summarize the steps; I encourage you to visit https://userChrome.org as a more complete resource.

  1. Enable Firefox to look for overrides
    1. navigate to about:config
    2. set toolkit.legacyUserProfileCustomizations.stylesheets to True
  2. Create ./chrome/userChrome.css in your Firefox profile path
  3. Add CSS overrides in userChrome.css
/* Adds keyword */
.editBMPanel_keywordRow[hidden]{
    visibility: visible !important;
    display: unset !important
}
/* Adds URL */
.editBMPanel_locationRow[hidden]{
    visibility: visible !important;
    display: unset !important;
}

This post in the Mozilla support forums turned me on to the identifier to look for, but I had to use Firefox’s Browser Toolbox and some fiddling to find the exact combo of CSS I needed. If you are more adept at CSS than I am, you can make all sorts of changes this way.

Do note that I recently discovered that this seems to affect the full “Bookmark Browser” behavior as well, by showing URL and keyword fields for bookmark folders in addition to regular bookmarks.

Multiple parameter searches

As shown with the multiple URL trick, you can bookmark javascript code. A more complicated bit of javascript you can use will parse a given substition parameter, split it on a given delimiter, and pass the split elements into a URL

Method 1: additive URL

This example builds a target url additively from a base address, with arguments delimited by semi-colon (;). It returns the directions for a given start and destination pair. Try (assuming keyword map): map kyoto;tokyo

javascript:
  var arguments = "%s".split(";");
  var target = "https://www.google.com/maps/dir/";
  if (arguments.length) target += arguments[0].substr(0);
  if (arguments.length > 1) target += "/" + arguments[1].substr(0);
  document.location.href = target;

This is modified from the example provided at https://kewisch.wordpress.com/2012/04/12/keyword-bookmarks-with-multiple-parameters/, with adjustments to the URL and concatenation.

This is viable for simpler URLs where the concatenation is trivial, as in the example provided. Anything that breaks from that require quite a lot of rewrite per bookmark, which is less than ideal. I’ve included it here for completeness of available options.

Method 2: multiple placeholder substitution

This example parses both the input arguments and the URL with multiple substitution (%s) locations. The arguments are delimited by spaces; quote any terms that need to include a non-delimiting space.

javascript:
var arguments = '%s';
originalURL = 'https://www.google.com/maps/dir/%s/%s';
tempArgs = '';
quoteChar = 0;
chunks = originalURL.split('%s');
for (i = 0; i < arguments.length; i++){
    if (arguments.charAt(i) == '"');
        quoteChar = quoteChar^1;
    t += ((arguments.charAt(i) ==' ' && qc)?'^':arguments.charAt(i));
    }
args = tempArgs.split(/\s/);
newURL = '';
for (i = 0; i < chunks.length; i++){
    newURL += chunks[i];
    if (args[i] != undefined) {
        args[i] = args[i].replace(/\^/g,' ');
        newURL += args[i];
        }
    }
location.replace(newURL);

Modified slightly from the example given at http://kb.mozillazine.org/Multiple_parameter_keyword_searches.

This option offers a more stream-lined workflow when adding new bookmarks, because only the URL needs to be updated for new bookmarks. However, the code is intimidating, and you shouldn’t trust code you don’t understand. To that end, I’ve worked through the code and commented it for my own understanding. That version is available here.

Open in reader mode

To open a URL directly into reader mode, bookmark about:reader?url=%s, substituting %s with the URL (or assign a keyword as-is to use dynamically). The site must already support reader mode.

Allow selecting text when disallowed

Some sites disallow selecting text, particularly NAS web-UIs. I don’t know why Synology doesn’t want me to be able to copy my disks’ serial numbers and firmware, but it makes documentation needlessly difficult.

On an affected site, you can usually disable all the variants of ‘user-select: none’ in affected elements’ styles.

  1. Press Ctrl+Shift+C to open the inspector tool
  2. Select the offending element
  3. In the ‘Filter Styles’ pane, search for “select”
  4. Disable any that imply selection is disabled

You can further dig into the CSS the page is using to find the same elements, which might be applied quite broadly. Disabling individually has been sufficent for my use cases.

Short-listed built-ins worth knowing

Special auto-complete searches

  • % - Search and switch to current open tabs
  • ^ - Search your history
  • * - Search bookmarks

A more complete list is given in Firefox’s docs on filtering auto-complete suggestions.

Shortcuts

  • Alt+D - Focus the navigation bar. Works in most file browsers, too.
  • Ctrl+Shift+C - opens page inspector tools. Good for finding div id’s or editing visibilities.
  • Ctrl+Shift+O - Bookmark manager. If you don’t have the userChrome.css set up, this is the best option to set keywords and URL values on bookmarks.
  • Ctrl+Tab - Cycle through tabs in order of last used.

Complete list from Firefox docs

Why I use Firefox - And you should too

There are very few real choices when it comes to web browsers. Google’s Chrome browser dominates the market by a large margin. Chrome is a proprietary build on top of Google’s open-source Chromium codebase. The same is true for MS Edge, Brave, Opera, Amazon Swift, Vivaldi, and many more. Firefox and Safari are the two most significant outliers; Safari accounts for about 20% of the global share, and Firefox for only about 3%1.

For me, and I think most of the world, web access is non-negotiable. To put that access wholly into any one party’s hands is irresponsible.Google’s recent changes have been a long time coming and demonstrate exactly why having alternatives is so critical.

Google is motivated by revenue, which comes from ads and user data. Company profit will always take precedence over benefitting the user. That’s dangerous with technology companies large enough to force changes to internet standards. Firefox, in comparison, is wholly open-source and is produced by the Mozilla Corporation, a taxable subsidiary of the non-profit Mozilla Foundation. That doesn’t make them saints2,3, but I find the situation significantly more palatable.

I use Firefox because it’s one of the last alternatives to a wholly profit-driven technology gargantuan who explicitly profits from collecting and selling YOUR data. I encourage you to consider joining me in demonstrating that Firefox is valued, necessary, and wanted - before it’s too late.