Firefox

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search

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

Contents

[edit] 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.

[edit] Firefox 19 - 27 (For current versions of WPKG)

This package is for versions of Firefox 19 and higher but works the same for versions of Firefox 19to 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="27.0" />
	<variable name="architecture" value="x86" />
	<variable name="locale" value="en-GB" />
	<!--  <variable name="locale" value="fr" /> -->
 
	<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 include="install" />
 
	<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>

[edit] Extensions

[edit] 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 mozilla.cfg:

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

In this way, no extension is disabled.

[edit] 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>


[edit] Customization

[edit] Make Firefox the Default Browser

[edit] 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>

[edit] 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>
 
</package>

See also Mozillazine on Default Browser.

[edit] 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 be 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 updates
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]


[edit] 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).


[edit] 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\"' />

[edit] 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);

[edit] Disable Profile Migrator

To prevent users being asked if they want to migrate their settings from Internet Explorer during first run create a file called 'override.ini' and add the following lines:

[XRE]
EnableProfileMigrator=false
[/align]

Copy this file to %PROGRAMFILES%\Mozilla Firefox\ or %PROGRAMFILES(x86)%\Mozilla Firefox\ during installation.

[edit] 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.

[edit] External Links

Retrieved from "http://wpkg.org/Firefox"
Personal tools
Namespaces
Variants
Actions
Navigation
ideas?
Toolbox