How to change “about:home” to anything in Firefox (Icecat, Iceweasel)

Before reading, please note that I’ve written this post with respect to Icecat 17.0.1 which is a rebranded version of Firefox. I can’t guarantee that things will work the same with Firefox or Iceweasel (another rebrand) or other versions of any of these Mozilla browsers.

The concept of a home page is not well defined in Firefox. In Edit->Preferences there is a Home Page setting. When Firefox starts, this is the url that will be displayed. But it’s not the url displayed when a new tab is created or when visiting about:home. Those are two other, independent settings. The first is set from the about:config screen by changing the preference browser.newtab.url. It’s also necessary to set browser.newtabpage.enabled to false. The latter is not easily changed. There is no preference to change it.

The about:home page is a static page included in the Firefox distribution. In can be found in the file omni.jar (or omni.ja in my distribution). The exact location of this file will depend on the distribution, the operating system, and probably the Firefox version. It’s probably easiest to find it by doing a search of your file system. One my try entering “chrome://browser/content/findme” in the address bar of a Firefox tab. The resulting error message might indicate where omni.jar is to be found.

Once located, the omni.jar file can be opened and it’s contents browsed and edited. I use fileroller on my Debian based pc to browse the contents of the archive. Inside the archive, you need to find the aboutHome.xhtml file. In my version of Icecat (17.0.1) it is located within the archive at /chrome/browser/content/branding/. If you don’t have a rebranded version of Firefox, you might find it at /chrome/browser/content/browser/abouthome/.

Open this file for editing. Within the <head> element of the xhtml page, simply add the following script tag:

<script>
window.location.href = "https://www.startpage.com";
</script>

Whenever about:home is accessed, the page will be automatically redirected to whatever url is set in the quotation marks. You can test this by typing “about:home” in the address bar of a Firefox tag. This shouldn’t require that you restart Firefox in order to work.

Playing around with the omni.jar file turns out to be a lot of fun. With my current configuration, I am able to browse the contents of the jar file using Firefox itself by typing in the following in the address bar of a tab: “jar:file:///home/Files/Programs/icecat-17.0.1/omni.ja!/”.

It also seems possible to access some components directly. For example, entering “chrome://browser/content/browser.xul” in the address bar of a tab, appears to load another instance of Firefox within that Firefox tab. It’s like a new Firefox window all contained within a tab. Very cool.

Screenshot - 03202014 - 03:35:10 PM

Tags: , , , , , , , , , , , , , , , , ,

3,590 views

This entry was posted on Thursday, March 20th, 2014 at 3:38 pm and is filed under Computer, Register, Software, Uncategorized, Web. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

4 Responses to “How to change “about:home” to anything in Firefox (Icecat, Iceweasel)”

  1. J-o-h-n- says:

    Wrote this powershell script to change about:Home file. Could not have done it without your information. FYI, found a way to find the omni.ja file location, while on the about:Home page, right click and select ‘View page source’ and the title will have the address in it. Here is the script if you are interested. Only tested on PSVersion 4.0.

    $site = "https://www.google.com/?gws_rd=ssl"
    $file = ls $env:ProgramFiles*\*firefox*\browser\omni.ja
    
    # Load ZipFile if necessary
    try { $null = [IO.Compression.ZipFile] }
    catch { [System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') }
    
    # Open zip file with update mode (Update, Read, Create -- are the options)
    try { $omni = [System.IO.Compression.ZipFile]::Open( $file, 'Update' ) }
    catch { throw "Another process, not necessarily Firefox, has locked the '$file' file." }
    
    # Read the contents of specific file to $text and release the file so to use streamwriter later
    $aboutHome = [System.IO.StreamReader]($omni.Entries | ? { $_.FullName -match 'aboutHome.xhtml' }).Open()
    $text = $aboutHome.ReadToEnd()
    $aboutHome.Close()
    $aboutHome.Dispose()
    
    # Add the script redirect to the file, point about:Home to $site
    $text = $text.Split("`r`n") |
    	% { $_
    		if ( $_ -match '' ) {
    			$lead = $_ -replace '^(\s*).*', '$1'
    			"$lead  `r`n$lead    window.location.href = '$site';`r`n$lead  "
    		}
    	}
    
    # Re-open the file this time with streamwriter
    $aboutHome = [System.IO.StreamWriter]($omni.Entries | ? { $_.FullName -match 'aboutHome.xhtml' }).Open()
    
    # Zero out the file
    $aboutHome.BaseStream.SetLength(0)
    
    # Insert the $text to the file and close
    $aboutHome.Write(($text -join "`r`n"))
    $aboutHome.Flush()
    $aboutHome.Close()
    
    # Close the zip file write the changes
    try { $omni.Dispose() }
    catch { throw "'$file' is locked, probably need to close Firefox." }
    • ecellingsworth says:

      J-o-h-n-,

      Great tip about finding the omni.jar file location. Actually, great script in general. I’m not familiar with Powershell for Windows but I’ll assume it works. I’m not inclined to write a *nix shell script equivalent at the moment, but maybe another interested reader will throw one up.

      Anyway, I’m stoked you found this information useful and thanks for contributing. I’m sure others will benefit from your hard work.

  2. J-o-h-n- says:

    Feel free to edit this so the code is quoted properly.
    Only saw your comment a few moments ago. This should work:

    #!/bin/sh
    site="https://www.google.com/?gws_rd=ssl"
    file="/usr/lib/firefox/browser/omni.ja"
    mkdir -p chrome/browser/content/browser/abouthome
    unzip -p $file chrome/browser/content/browser/abouthome/aboutHome.xhtml > chrome/browser/content/browser/abouthome/aboutHome.xhtml
    sed -i "s,^\(\s*\)\(.*\)$,\1\2\n\1  \n\1    window.location.href = \"${site//\//\\/}\"\n\1  ," chrome/browser/content/browser/abouthome/aboutHome.xhtml
    zip $file chrome/browser/content/browser/abouthome/aboutHome.xhtml
    rm -rf chrome/

Leave a Reply


7 − = six