Difference between revisions of "Firefox"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
(Installation)
Line 582: Line 582:
  
 
policies.js should be located in %PROGRAMFILES%\Mozilla Firefox\defaults\pref\ and mozilla.cfg should be located in %PROGRAMFILES%\Mozilla Firefox\.
 
policies.js should be located in %PROGRAMFILES%\Mozilla Firefox\defaults\pref\ and mozilla.cfg should be located in %PROGRAMFILES%\Mozilla Firefox\.
 +
 +
For Firefox 10 (maybe previous version, not tested), to  stop the prompt to 'send my usage stats and data to some server somewhere in the world', add to mozilla.cfg
 +
 +
<source lang="javascript">
 +
lockPref("toolkit.telemetry.enabled", false);
 +
lockPref("toolkit.telemetry.rejected", true);
 +
lockPref("toolkit.telemetry.prompted", 2);
 +
</source>
 +
 +
To set the startup web page for all new and current users when they press the button 'Restore to Default':
 +
 +
- In notepad, create a new file with the contents:
 +
 +
<source lang="xml">
 +
browser.startup.homepage=http://www.maths.cam.ac.uk
 +
</source>
 +
 +
(change the URL to something more personal)
 +
 +
Save the file as browserconfig.properties
 +
 +
- Add this file to the archive file C:\program files (x86)\Mozilla Firefox\omni.ja by using 7-zip
 +
 +
<source lang="xml">
 +
7z.exe a "C:\program files (x86)\Mozilla Firefox\omni.ja" [path to browserconfig.properties]
 +
</source>
 +
 +
 +
To turn on the bookmark toolbar and display the menu bar, either:
 +
 +
1. Copy the following into a file called C:\program files (x86)\Mozilla Firefox\defaults\profile\localstore.rdf (the dir \profile may not exist, if it doesn't, create it).
 +
 +
<source lang="xml">
 +
<?xml version="1.0"?>
 +
<RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
 +
        xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
 +
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#PersonalToolbar"
 +
                  collapsed="false"
 +
                  currentset="personal-bookmarks" />
 +
  <RDF:Description RDF:about="chrome://browser/content/browser.xul">
 +
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#main-window"/>
 +
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#PersonalToolbar"/>
 +
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#navigator-toolbox"/>
 +
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#toolbar-menubar"/>
 +
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#nav-bar"/>
 +
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#TabsToolbar"/>
 +
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#addon-bar"/>
 +
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#sidebar-box"/>
 +
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#sidebar-title"/>
 +
  </RDF:Description>
 +
  <RDF:Description RDF:about="chrome://global/content/customizeToolbar.xul#CustomizeToolbarWindow"
 +
                  width="533"
 +
                  height="470" />
 +
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#TabsToolbar"
 +
                  currentset="tabbrowser-tabs,new-tab-button,alltabs-button,tabs-closebutton" />
 +
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#sidebar-title"
 +
                  value="" />
 +
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#addon-bar"
 +
                  currentset="addonbar-closebutton,spring,status-bar" />
 +
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#nav-bar"
 +
                  currentset="unified-back-forward-button,reload-button,stop-button,home-button,urlbar-container,search-container,bookmarks-menu-button-container,fullscreenflex,window-controls" />
 +
  <RDF:Description RDF:about="chrome://browser/content/preferences/preferences.xul#BrowserPreferences"
 +
                  lastSelected="paneMain" />
 +
  <RDF:Description RDF:about="chrome://browser/content/preferences/preferences.xul">
 +
    <NC:persist RDF:resource="chrome://browser/content/preferences/preferences.xul#BrowserPreferences"/>
 +
  </RDF:Description>
 +
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#navigator-toolbox"
 +
                  tabsontop="false" />
 +
  <RDF:Description RDF:about="chrome://global/content/customizeToolbar.xul">
 +
    <NC:persist RDF:resource="chrome://global/content/customizeToolbar.xul#CustomizeToolbarWindow"/>
 +
  </RDF:Description>
 +
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#sidebar-box"
 +
                  sidebarcommand=""
 +
                  width=""
 +
                  src="" />
 +
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#toolbar-menubar"
 +
                  autohide="false"
 +
                  currentset="menubar-items" />
 +
</RDF:RDF>
 +
</source>
 +
 +
OR
 +
 +
2.  To manually create localstore.rdf, create a new firefox profile, customise the toolbars and quit firefox.  Copy the file localstore.rdf is the profile just created to C:\program files (x86)\Mozilla Firefox\defaults\profile\localstore.rdf (the dir \profile may not exist, if it doesn't, create it).
 +
  
 
==== Adding the settings to your package definition ====
 
==== Adding the settings to your package definition ====

Revision as of 13:26, 19 March 2012

This page is for Mozilla Firefox, available from mozilla.com.

Installation

Link to latest Firefox installer at:

Command-line options for the installer are documented here, which also describes how to use a config.ini file for basic configuration of the Firefox install.

See Firefox#Customization for details on customizing the installation, installing extensions, and setting and locking preferences.

The section below called firefox#Adding_the_settings_to_your_package_definition contains the extra lines you'll need to supply Firefox with a specific configuration.

Firefox 10.0 series (For current versions of WPKG)

This package is for versions of Firefox 10 but works the same for versions of Firefox 9, 8, 7, 6, 5 and 4.

This package works with 32-bit and 64-bit architectures but requires you alter the 'architecture' value for 64-bit systems.

<package 
	id="firefox"
	name="Mozilla Firefox"
	revision="%version%"
	reboot="false"
	priority="10">
 
	<variable name="version" value="10.0.1" />
	<variable name="architecture" value="x86" />
	<variable name="locale" value="en-GB" />
 
	<check type="uninstall" condition="exists" path="Mozilla Firefox %version% (%architecture% %locale%)" />
 
	<install cmd="taskkill /F /IM Firefox.exe">
		<exit code="0" />
		<exit code="-1073741515" />
		<exit code="128" />
	</install>
 
	<install cmd='"%SOFTWARE%\firefox\Firefox Setup %version%.exe" -ms' />
 
	<upgrade cmd="taskkill /F /IM Firefox.exe">
		<exit code="0" />
		<exit code="128" />
		<exit code="-1073741515" />
	</upgrade>
 
	<upgrade cmd='"%SOFTWARE%\firefox\Firefox Setup %version%.exe" -ms' />
 
	<remove cmd="taskkill /F /IM Firefox.exe">
		<exit code="0" />
		<exit code="128" />
		<exit code="-1073741515" />
	</remove>
 
        <!-- for 32bit and 64bit System -->
	<remove cmd='%COMSPEC% /C if exist "%PROGRAMFILES%\Mozilla Firefox\uninstall\helper.exe" "%PROGRAMFILES%\Mozilla Firefox\uninstall\helper.exe" -ms' />
	<remove cmd='%COMSPEC% /C if exist "%PROGRAMFILES(x86)%\Mozilla Firefox\uninstall\helper.exe" "%PROGRAMFILES(x86)%\Mozilla Firefox\uninstall\helper.exe" -ms' />
 
</package>

Firefox 8 (Requires WPKG 1.2.1-RC20 or higher)

This package is for Firefox 8 but works the same for Firefox 7, 6, 5 and 4.

This package works without modification for 32-bit and 64-bit architectures.

<?xml version="1.0" encoding="UTF-8"?>
<packages:packages
        xmlns:packages="http://www.wpkg.org/packages" xmlns:wpkg="http://www.wpkg.org/wpkg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.wpkg.org/packages ../xsd/packages.xsd" >

    <package
            id="firefox"
            name="Mozilla Firefox"
            revision="%PKG_VERSION%-20111111"
            reboot="false"
            priority="10">

        <variable name="PKG_VERSION"     value="8.0" />
        <variable name="PKG_EXE_VERSION" value="8.0.0.4325" />
        <variable name="PKG_DESTINATION" value="%ProgramFiles%\Mozilla Firefox"      architecture="x86"/>
        <variable name="PKG_DESTINATION" value="%ProgramFiles(x86)%\Mozilla Firefox" architecture="x64"/>

        <!-- default language is English -->
        <variable name="PKG_LANGUAGE"    value="en-us"/>
        <!-- overwrite default language for German systems -->
        <variable name="PKG_LANGUAGE"    value="de" lcid="407,c07,1407,1007,807"/>
        <!-- overwrite default language for Dutch systems -->
        <variable name="PKG_LANGUAGE"    value="nl" lcid="813,413"/>

        <check type="uninstall" condition="versiongreaterorequal" path="Mozilla Firefox .+"            value="%PKG_VERSION%" />
        <check type="file"      condition="versiongreaterorequal" path="%PKG_DESTINATION%\firefox.exe" value="%PKG_EXE_VERSION%" />

        <install cmd="taskkill /F /IM Firefox.exe">
          <exit code="0" />
          <exit code="128" />
          <exit code="1" />
        </install>
        <install cmd='"%SOFTWARE%\Firefox\Firefox Setup %PKG_VERSION% %PKG_LANGUAGE%.exe" /S' />

        <upgrade include="install" />

        <remove cmd="taskkill /F /IM Firefox.exe">
          <exit code="0" />
          <exit code="128" />
          <exit code="1" />
        </remove>
        <remove cmd='"%PKG_DESTINATION%\uninstall\helper.exe" /s' />
    </package>
</packages:packages>

Firefox 3.6 series

The silent install switch -ms is no longer considered deprecated.

<package 
  id="firefox"
  name="Mozilla Firefox 3.6"
  revision="%version%"
  reboot="false"
  priority="10">

  <variable name="version" value="3.6.24" />

  <check
    type="uninstall"
    condition="exists"
    path="Mozilla Firefox (%version%)" />

  <install cmd="taskkill /F /IM Firefox.exe">
    <exit code="0" />
    <exit code="128" />
    <exit code="-1073741515" />
  </install>
  <install cmd='"%SOFTWARE%\firefox\Firefox Setup %version%.exe" -ms' />

  <upgrade cmd="taskkill /F /IM Firefox.exe">
    <exit code="0" />
    <exit code="128" />
    <exit code="-1073741515" />
  </upgrade>
  <upgrade cmd='"%SOFTWARE%\firefox\Firefox Setup %version%.exe" -ms' />

  <remove cmd="taskkill /F /IM Firefox.exe">
    <exit code="0" />
    <exit code="128" />
    <exit code="-1073741515" />
  </remove>
  <remove cmd='"%PROGRAMFILES%\Mozilla Firefox\uninstall\helper.exe" /s' />
</package>

Firefox 3.5 series

In this series the silent install command line switch must be "-ms" because "/S" is broken (bug 506867, except for the uninstall, it seems), even though Installer:Command_Line_Arguments says "-ms" is deprecated.

<package 
	id="firefox35"
	name="Mozilla Firefox 3.5.19"
	revision="1"
	reboot="false"
	priority="10">
	
	<check type="uninstall" condition="exists" path="Mozilla Firefox (3.5.19)" />
	<install cmd="taskkill /F /IM Firefox.exe">
		<exit code="0" />
		<exit code="128" />
                <exit code="-1073741515" />
	</install>
	<install cmd='"%SOFTWARE%\Internet\firefox\Firefox Setup 3.5.19.exe" -ms' />
	<upgrade cmd="taskkill /F /IM Firefox.exe">
		<exit code="0" />
		<exit code="128" />
                <exit code="-1073741515" />
	</upgrade>
	<upgrade cmd='"%SOFTWARE%\Internet\firefox\Firefox Setup 3.5.19.exe" -ms' />
	<remove cmd="taskkill /F /IM Firefox.exe">
		<exit code="0" />
		<exit code="128" />
                <exit code="-1073741515" />
	</remove>
	<remove cmd='"%PROGRAMFILES%\Mozilla Firefox\uninstall\helper.exe" /s' />
</package>

Firefox 3.0 series

As the Firefox installer now nicely upgrades and doesn't leave the old one in the registry, there is no need to differentiate versions in "package id".

<package 
	id="firefox3"
	name="Mozilla Firefox 3"
	revision="1"
	reboot="false"
	priority="10">
	
	<check type="uninstall" condition="exists" path="Mozilla Firefox (3.0.19)" />
	<install cmd="taskkill /F /IM Firefox.exe">
		<exit code="0" />
		<exit code="128" />
	</install>
	<install cmd='"%SOFTWARE%\Internet\firefox\Firefox Setup 3.0.19.exe" /S' />
	<upgrade cmd="taskkill /F /IM Firefox.exe">
		<exit code="0" />
		<exit code="128" />
	</upgrade>
	<upgrade cmd='"%SOFTWARE%\Internet\firefox\Firefox Setup 3.0.19.exe" /S' />
	<remove cmd="taskkill /F /IM Firefox.exe">
		<exit code="0" />
		<exit code="128" />
	</remove>
	<remove cmd='"%PROGRAMFILES%\Mozilla Firefox\uninstall\helper.exe" /S' />
</package>

Firefox 2.0 series

<package 
    id="firefox" 
    name="Mozilla Firefox 2.0" 
    revision="1" 
    reboot="false" 
    priority="10">
 
    <check type="logical" condition="or">
      <check type="uninstall" condition="exists" path="Mozilla Firefox (2.0)" />
      <check type="uninstall" condition="exists" path="Mozilla Firefox (2.0.0.20)" />
    </check>
    <check type="file" condition="exists" path="%PROGRAMFILES%\Mozilla Firefox\firefox.exe"/>
 
    <install cmd='"%SOFTWARE%\firefox\Firefox Setup 2.0.0.20.exe" -ms' />
    <upgrade cmd='"%SOFTWARE%\firefox\Firefox Setup 2.0.0.20.exe" -ms' />
    <remove cmd='"%PROGRAMFILES%\Mozilla Firefox\uninstall\helper.exe" -ms' />
 
</package>

Firefox 1.5 series

<package 
    id="firefox" 
    name="Mozilla Firefox 1.5" 
    revision="1" 
    reboot="false" 
    priority="10">
 
    <check type="uninstall" condition="exists" path="Mozilla Firefox (1.5)" />

    <install cmd='"%SOFTWARE%\firefox\Firefox Setup 1.5.0.12.exe" -ms' />
    <upgrade cmd='"%SOFTWARE%\firefox\Firefox Setup 1.5.0.12.exe" -ms' />
    <remove cmd='"%PROGRAMFILES%\Mozilla Firefox\uninstall\uninstall.exe" -ms' />

</package>

Extensions

Initial extension automatic checking and disabling

When upgrading to a new version, Firefox does an initial check for extensions compatibility and shows a dialog box disabiling all them automatically.

To prevent this, configure mozzila.cfg:

pref("extensions.shownSelectionUI", true);
pref("extensions.autoDisableScopes", 0);

In this way, no extension is disabled.

Firefox 4 Series Extensions

Firefox 4 handles extensions the same as 3.6 with two differences. First, not all extensions need to be extracted first. This depends on the extension, so you'll have to test each one to find out or just extract them all anyways. Second, globally installed extensions (under Program Files rather than the user profile) need a registry key added.

<package
  id="firefox-adblock"
  name="Adblock+"
  revision="%version%"
  priority="10">

  <variable name="version" value="1.3.7" />
  <variable name="extid" value="{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}" />

  <check
    type="file"
    condition="exists"
    path="%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%\chrome.manifest" />

  <install cmd='%COMSPEC% /C xcopy /E /Y "%SOFTWARE%\apps\firefox\adblock\%version%" "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%\"' />
  <install cmd='%COMSPEC% /C reg add "HKLM\Software\Mozilla\Firefox\Extensions" /v %extid% /d "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%" /f' />
	
  <upgrade cmd="taskkill /F /IM Firefox.exe">
    <exit code="0" />
    <exit code="128" />
  </upgrade>
  <upgrade cmd='%COMSPEC% /C if exist "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%" rmdir /q /s "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%"' />
  <upgrade cmd='%COMSPEC% /C xcopy /E /Y "%SOFTWARE%\apps\firefox\adblock\%version%" "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%\"' />
  <upgrade cmd='%COMSPEC% /C reg add "HKLM\Software\Mozilla\Firefox\Extensions" /v %extid% /d "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%" /f' />
		
  <remove cmd="taskkill /F /IM Firefox.exe">
    <exit code="0" />
    <exit code="128" />
  </remove>
  <remove cmd='%COMSPEC% /C if exist "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%" rmdir /q /s "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%"' />
  <remove cmd='%COMSPEC% /C reg delete "HKLM\Software\Mozilla\Firefox\Extensions" /v %extid% /f' />
</package>

Firefox 3.6 Series Extensions

Starting in 3.6, the -install-global-extension command-line parameter is deprecated and the new official procedure to install a global extension is: extract the extension and copy the folder to the %ProgramFiles%\Mozilla Firefox\extensions folder with a folder name matching the extension GUID.

If you have a large number of extensions to manage, consider using the Extension Templates described in the next section.

In your repository under the firefox folder, create a folder for each extension you want to package. Save the downloaded XPI to that folder. To download and extension from addons.mozilla.org, right-click on the Add to Firefox button and choose Save Link As. Create a folder in the extension folder for each new version of the extension. Extract the extension to its respective version folder. Extensions can be extracted as ZIP files, either by appending a .zip extension or using your preferred archive utility. See below for an example of the recommended directory structure.

%SOFTWARE%\
    firefox\
        Firefox Setup 3.6.7.exe
        Firefox Setup 3.6.8.exe
        adblock\
            adblock_plus-1.2-fx+sm+tb+fn.xpi
            adblock_plus-1.2.1-fx+sm+tb+fn.xpi
            1.2\
                <extracted extension files>
            1.2.1\
                <extracted extension files>

After you have extracted the extension, open the install.rdf file to retrieve the extension's GUID. The extension GUID shouldn't change between versions. This is also a good opportunity to double-check the version number. Look for the line near the top, like this one from Adblock Plus:

<em:id>{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}</em:id>

Now that you have extracted the extension and retrieved the extension GUID you can create the package. The following is an example for Adblock Plus:

<package
  id="firefox-adblock"
  name="Adblock+"
  revision="%version%"
  priority="10">
		
  <variable name="version" value="1.2.1" />
  <variable name="extid" value="{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}" />
		
  <check
    type="file"
    condition="exists"
    path="%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%\chrome.manifest" />

  <install cmd='%COMSPEC% /C xcopy /E /Y "%SOFTWARE%\apps\firefox\adblock\%version%" "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%\"' />
		
  <upgrade cmd="taskkill /F /IM Firefox.exe">
    <exit code="0" />
    <exit code="128" />
    <exit code="-1073741515" />
  </upgrade>
  <upgrade cmd='%COMSPEC% /C if exist "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%" rmdir /q /s "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%"' />
  <upgrade cmd='%COMSPEC% /C xcopy /E /Y "%SOFTWARE%\apps\firefox\adblock\%version%" "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%\"' />
		
  <remove cmd="taskkill /F /IM Firefox.exe">
    <exit code="0" />
    <exit code="128" />
    <exit code="-1073741515" />
  </remove>
  <remove cmd='%COMSPEC% /C if exist "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%" rmdir /q /s "%PROGRAMFILES%\Mozilla Firefox\extensions\%extid%"' />
</package>

If your extension requires additional configuration you can install it manually, make your changes, and then save the <extension>.js file from %AppData%\Mozilla\Firefox\Profiles\<random>\extensions\<extension GUID>\defaults\preferences. This file can then either be copied into your extracted copy of the extension, or it can be copied over with an additional install/upgrade action in the package definition from another location.

Note that there is no easy way to check the installed version of an extension. Also note that non-admin users will not be able to upgrade extensions which are installed globally. It's important to monitor extensions installed this way for updates.

Firefox 3.6 Series Extension Templates

As stated in: Firefox#Firefox_3.0_Series_Extensions the "install-global-extension" switch doesn't work starting with Firefox 3.6.

So, there is a better and much smoother way deploying extensions. And: it makes adding a new extension to a WPKG repo about 80 percent easier: templating.

Here are some examples:

packages/firefox-ext-adblock_plus.xml

<!DOCTYPE firefoxextension [ <!ENTITY ext-name "adblock_plus"> <!ENTITY ext-key "1.1.3-fx+sm+tb+fn"> <!ENTITY ff-extension SYSTEM "../templates/ff-extension.xml"> ]>
<packages>&ff-extension;</packages>

packages/firefox-ext-ie_view.xml

<!DOCTYPE firefoxextension [ <!ENTITY ext-name "ie_view"> <!ENTITY ext-key "1.4.5.1-fx+sm-win"> <!ENTITY ff-extension SYSTEM "../templates/ff-extension.xml"> ]>
<packages>&ff-extension;</packages>

packages/firefox-ext-screengrab.xml

<!DOCTYPE firefoxextension [ <!ENTITY ext-name "screengrab"> <!ENTITY ext-key "0.96.3-fx"> <!ENTITY ff-extension SYSTEM "../templates/ff-extension.xml"> ]>
<packages>&ff-extension;</packages>

What we see here: creating a new extension package is just as easy as putting the extension name and version key in, so that the variables "ext-name" and "ext-key" build together with "-" the name of the xpi file: screengrab-0.96.3-fx.xpi.

And updates? Updates have never been easier: Save the xpi to packages/mozilla/fx_extensions/ and change the "ext-key" variable in firefox-ext-(extname).xml.

The following template is used together with install-extensions.cmd and remove-extensions.cmd. For your convenience, you can find all needed files here: Firefox_ext_install_downloads.

templates/ff-extension.xml

<package id='firefox-ext-&ext-name;' name='Firefox Extension &ext-name;' revision='&ext-key;' priority='15'>
    <variable name='fxext' value='&ext-name;-&ext-key;'/>
    <check type="file" condition="exists" path="%CommonProgramFiles%\Mozilla Shared\Extensions\%FXEXT%\install.rdf" />
    <depends package-id="firefox-check" />
    <install cmd='"%SOFTWARE%\packages\mozilla\install-extensions.cmd" Firefox %FXEXT% >nul'/>
    <upgrade cmd='"%SOFTWARE%\packages\mozilla\install-extensions.cmd" Firefox %FXEXT% >nul'/>
    <downgrade cmd='"%SOFTWARE%\packages\mozilla\install-extensions.cmd" Firefox %FXEXT% >nul'/>
    <remove cmd='"%SOFTWARE%\packages\mozilla\remove-extensions.cmd" Firefox %FXEXT% >nul'/>
</package>

Firefox 2.0 Series Extensions

See Firefox2 extensions

New limitations on -install-global-extension parameter in version 2.0.0.7

Be aware that, for security reasons, Mozilla Firefox 2.0.0.7 will no longer allow global extensions or global themes to be installed from HTTP or UNC paths via the -install-global-extension or the -install-global-theme command line parameters:

http://larholm.com/2007/09/

You must copy your XPI on local drive before install this. (for example)

 
<install cmd='cmd /C copy /Y "%SOFTWARE%\mozilla\fx_extensions\firebug-1.05-fx+fl.xpi" c:\NETINST' />
<install cmd='"%PROGRAMFILES%\Mozilla Firefox\FIREFOX.EXE" -install-global-extension c:\NETINST\firebug-1.05-fx+fl.xpi' />
<install cmd='cmd /C del /q /S c:\NETINST\firebug-1.05-fx+fl.xpi'/>

Customization

Make Firefox the Default Browser

Option 1

Use the uninstall helper to set Firefox as the default browser. Add these lines to your package definition after the lines that install or upgrade Firefox.

<install cmd='%ComSpec% /c if %PROCESSOR_ARCHITECTURE% == x86 "%PROGRAMFILES%\Mozilla Firefox\uninstall\helper.exe" /SetAsDefaultAppGlobal' >
  <exit code="2" />
</install>
<install cmd='%ComSpec% /c if %PROCESSOR_ARCHITECTURE% == AMD64 "%PROGRAMFILES(x86)%\Mozilla Firefox\uninstall\helper.exe" /SetAsDefaultAppGlobal' >
  <exit code="2" />
</install>

<upgrade cmd='%ComSpec% /c if %PROCESSOR_ARCHITECTURE% == x86 "%PROGRAMFILES%\Mozilla Firefox\uninstall\helper.exe" /SetAsDefaultAppGlobal' >
  <exit code="2" />
</upgrade>
<upgrade cmd='%ComSpec% /c if %PROCESSOR_ARCHITECTURE% == AMD64 "%PROGRAMFILES(x86)%\Mozilla Firefox\uninstall\helper.exe" /SetAsDefaultAppGlobal' >
  <exit code="2" />
</upgrade>

Option 2

This one will set Firefox as the default browser for all users - it will try to start Firefox in the background, which will set itself as the default browser. After 10 seconds, we kill the Firefox process, as it's no longer needed, and repeat the process again to make sure we really did set the default browser to Firefox (it's needed to do it like this in some circumstances). Note the "taskkill" command exists in Windows XP Pro (and probably Windows Server 2003) but not Windows 2000 or XP Home.

<package
     id="firefox-default"
     name="Make Firefox the default browser"
     revision="1"
     priority="0"
     execute="once">
 
  <install timeout="10" cmd='"%PROGRAMFILES%\Mozilla Firefox\firefox.exe" -silent -nosplash -setDefaultBrowser' >
   <exit code="-1" />
   <exit code="0" />
  </install>
 <install cmd='ping 127.0.0.1 -n 10>NUL' />
 <install cmd='taskkill /F /IM Firefox.exe' >
   <exit code="0" />
   <exit code="128" />
 </install>
  <install timeout="10" cmd='"%PROGRAMFILES%\Mozilla Firefox\firefox.exe" -silent -nosplash -setDefaultBrowser' >
   <exit code="-1" />
   <exit code="0" />
  </install>
 <install cmd='ping 127.0.0.1 -n 10>NUL' />
 <install cmd='taskkill /F /IM Firefox.exe' >
   <exit code="0" />
   <exit code="128" />
 </install>
 
</package>

See also Mozillazine on Default Browser.

Setting and Locking Preferences

Firefox supports the ability to both set and lock user preferences. This feature is useful for forcing all users to use a specific proxy server, setting or forcing a homepage, disabling automatic updates, and so on.

Create a file called policies.js with the following contents:

pref("general.config.obscure_value", 0);
pref("general.config.filename", "mozilla.cfg");

You may choose to use obscured values in mozilla.cfg by changing the obscure_value above to 13 (for byteshift 13), but beware you will need to go through an additional step to convert the plain-text config to an obscured version every time you make a change. Also note that the method used to obscure the config file is easily reversible. For example:

pref("general.config.obscure_value", 13);
pref("general.config.filename", "mozilla.cfg");

Next, create your mozilla.cfg file. Open Firefox and enter about:config in the address bar to see all of the available configuration options. Note that the first line must a comment, any options configured in the first line will be ignored.

If using an obscured config, this should be saved as mozilla.txt instead and converted to an obscured mozilla.cfg. Normaly you can do a online conversion at: http://alain.knaff.linux.lu/howto/MozillaCustomization/cgi/byteshf.cgi Unfortunately this web site is out of order for now.

If any issues you may alternatively run moz-byteshift.pl available here - https://developer.mozilla.org/en/Automatic_Mozilla_Configurator/Locked_config_settings The perl interpreter is required - http://www.activestate.com/activeperl

//

// Don't show the Firefox has been upgraded page
lockPref("browser.startup.homepage_override.mstone", "ignore");

// Don't check for the default browser
lockPref("browser.shell.checkDefaultBrowser", false);

// Disable automatic updatese
lockPref("app.update.enabled", false);

// Set the homepage
lockPref("browser.startup.homepage", "http://www.example.com/");
lockPref("browser.startup.page", 1);

// Proxy configuration
lockPref("network.proxy.backup.ftp", "your.proxy");
lockPref("network.proxy.backup.ftp_port", 3128);
lockPref("network.proxy.backup.gopher", "your.proxy");
lockPref("network.proxy.backup.gopher_port", 3128);
lockPref("network.proxy.backup.socks", "your.proxy");
lockPref("network.proxy.backup.socks_port", 3128);
lockPref("network.proxy.backup.ssl", "your.proxy");
lockPref("network.proxy.backup.ssl_port", 3128);
lockPref("network.proxy.ftp", "your.proxy");
lockPref("network.proxy.ftp_port", 3128);
lockPref("network.proxy.gopher", "your.proxy");
lockPref("network.proxy.gopher_port", 3128);
lockPref("network.proxy.http", "your.proxy");
lockPref("network.proxy.http_port", 3128);

lockPref("network.proxy.no_proxies_on", "192.168.*,localhost,127.0.0.1, glpi, glpi.your.domain");

lockPref("network.proxy.share_proxy_settings", true);
lockPref("network.proxy.socks", "your.proxy");
lockPref("network.proxy.socks_port", 3128);
lockPref("network.proxy.ssl", "your.proxy");
lockPref("network.proxy.ssl_port", 3128);
lockPref("network.proxy.type", 1);

You can find more details on locking preferences here: http://kb.mozillazine.org/Locking_preferences

Note that you can use pref() instead of lockPref() if you only want to set the default and allow users to change the setting later.

policies.js should be located in %PROGRAMFILES%\Mozilla Firefox\defaults\pref\ and mozilla.cfg should be located in %PROGRAMFILES%\Mozilla Firefox\.

For Firefox 10 (maybe previous version, not tested), to stop the prompt to 'send my usage stats and data to some server somewhere in the world', add to mozilla.cfg

lockPref("toolkit.telemetry.enabled", false);
lockPref("toolkit.telemetry.rejected", true);
lockPref("toolkit.telemetry.prompted", 2);

To set the startup web page for all new and current users when they press the button 'Restore to Default':

- In notepad, create a new file with the contents:

browser.startup.homepage=http://www.maths.cam.ac.uk

(change the URL to something more personal)

Save the file as browserconfig.properties

- Add this file to the archive file C:\program files (x86)\Mozilla Firefox\omni.ja by using 7-zip

7z.exe a "C:\program files (x86)\Mozilla Firefox\omni.ja" [path to browserconfig.properties]


To turn on the bookmark toolbar and display the menu bar, either:

1. Copy the following into a file called C:\program files (x86)\Mozilla Firefox\defaults\profile\localstore.rdf (the dir \profile may not exist, if it doesn't, create it).

<?xml version="1.0"?>
<RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
         xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#PersonalToolbar"
                   collapsed="false"
                   currentset="personal-bookmarks" />
  <RDF:Description RDF:about="chrome://browser/content/browser.xul">
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#main-window"/>
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#PersonalToolbar"/>
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#navigator-toolbox"/>
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#toolbar-menubar"/>
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#nav-bar"/>
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#TabsToolbar"/>
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#addon-bar"/>
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#sidebar-box"/>
    <NC:persist RDF:resource="chrome://browser/content/browser.xul#sidebar-title"/>
  </RDF:Description>
  <RDF:Description RDF:about="chrome://global/content/customizeToolbar.xul#CustomizeToolbarWindow"
                   width="533"
                   height="470" />
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#TabsToolbar"
                   currentset="tabbrowser-tabs,new-tab-button,alltabs-button,tabs-closebutton" />
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#sidebar-title"
                   value="" />
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#addon-bar"
                   currentset="addonbar-closebutton,spring,status-bar" />
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#nav-bar"
                   currentset="unified-back-forward-button,reload-button,stop-button,home-button,urlbar-container,search-container,bookmarks-menu-button-container,fullscreenflex,window-controls" />
  <RDF:Description RDF:about="chrome://browser/content/preferences/preferences.xul#BrowserPreferences"
                   lastSelected="paneMain" />
  <RDF:Description RDF:about="chrome://browser/content/preferences/preferences.xul">
    <NC:persist RDF:resource="chrome://browser/content/preferences/preferences.xul#BrowserPreferences"/>
  </RDF:Description>
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#navigator-toolbox"
                   tabsontop="false" />
  <RDF:Description RDF:about="chrome://global/content/customizeToolbar.xul">
    <NC:persist RDF:resource="chrome://global/content/customizeToolbar.xul#CustomizeToolbarWindow"/>
  </RDF:Description>
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#sidebar-box"
                   sidebarcommand=""
                   width=""
                   src="" />
  <RDF:Description RDF:about="chrome://browser/content/browser.xul#toolbar-menubar"
                   autohide="false"
                   currentset="menubar-items" />
</RDF:RDF>

OR

2. To manually create localstore.rdf, create a new firefox profile, customise the toolbars and quit firefox. Copy the file localstore.rdf is the profile just created to C:\program files (x86)\Mozilla Firefox\defaults\profile\localstore.rdf (the dir \profile may not exist, if it doesn't, create it).


Adding the settings to your package definition

Add the following to your package definition in the appropriate places:

<check type="file" condition="exists" path="%PROGRAMFILES%\Mozilla Firefox\defaults\pref\policies.js" />
<check type="file" condition="exists" path="%PROGRAMFILES%\Mozilla Firefox\mozilla.cfg" />

<install cmd='%COMSPEC% /c copy /y "%SOFTWARE%\apps\firefox\policies.js" "%PROGRAMFILES%\Mozilla Firefox\defaults\pref\"' />
<install cmd='%COMSPEC% /c copy /y "%SOFTWARE%\apps\firefox\mozilla.cfg" "%PROGRAMFILES%\Mozilla Firefox\"' />

<upgrade cmd='%COMSPEC% /c copy /y "%SOFTWARE%\apps\firefox\policies.js" "%PROGRAMFILES%\Mozilla Firefox\defaults\pref\"' />
<upgrade cmd='%COMSPEC% /c copy /y "%SOFTWARE%\apps\firefox\mozilla.cfg" "%PROGRAMFILES%\Mozilla Firefox\"' />

Disable Automatic Updates

If Firefox is started by a user without administrative powers, automatic Firefox update will fail - which is harmless, but can confuse some users. To disable Firefox automatic updates, read the section on setting and locking preferences above first, and then add this line to your mozilla.cfg file:

lockPref("app.update.enabled", false);

Firefox Client Customization Kit

The Firefox Client Customization Kit makes it easy for administrators to customize Firefox with home page settings, proxies, extensions, etc. Also, you can lock preferences so that you users cannot change them. Version 1.2 has introduced support for Firefox 3.x, version 1.2.5 has dropped support for Firefox 2.x and only works for Firefox 3.x and later.

External Links