Virtualising Firefox with App-V 5 SP3

Hey there. I’ve been a bit quiet of late but sadly I am not doing much in the way of ground breaking IT (lol?) due to stuff going on at work. We’ve got a restructure of the entire Company going on, coupled with an internal restructure of the IT division in conjunction with a Voluntary Redundancy Scheme (where noone seems to know who will still be here once implemented).

Fun times.

I thought I’d plug the gap by posting up my recipe for Firefox. I’ve seen a few ways of virtualising this app, but as yet none quite like mine. All the files I use have their contents in this post; you’re free to copy them ad inifitnitum.

Bear in mind that I started this recipe waaaaaay back with SoftGrid 4.2 and Firefox v3.x! Oh and another thing, I rolled out App-V 5 SP3. With this version of the Sequencer, there is no PVAD any more. As in, you don’t need to know the install directory path in advance!

Due to certain business requirements we have, Firefox needs to handle PDF’s in a particular way. So this recipe will require Adobe Reader (or whatever is your poison) installed before you start sequencing. Make sure you go through the first run of Reader before you start sequencing!

Load the template; this is important as you want to include things that otherwise would not be included.

Run the Firefox installer; make sure you go for the custom install option and then untick the option to install that annoying Maintenance Service. As a rule of thumb I tick the default browser option to ensure the key changes are captured, however in this environment we don’;t have Firefox as a default browser.

Complete the install, and let the browser launch. We need certain first run files in place before going further.

Close Firefox down, and we will look at my customisations. There are three files which affect Firefox’s behaviour:

  • Browser-Custom.JS
  • Mozilla.cfg
  • profiles.ini

I have found that some Firefox settings can be set from Browser-Custom.JS, but not Mozilla.cfg and vice versa. it is also worth noting that these two files work differently, and live in different locations. The Browser-Custom.JS is a generic file and used to come as part of Firefox; you probably won’t have one! However this file is needed, as it “enables” the Mozilla.cfg file.

The contents of the Browser-Custom.JS

// Prefs
pref(“”, false);
pref(“browser.preferences.advanced.selectedTabIndex”, 3);
pref(“browser.privatebrowsing.autostart”, true);
pref(“signon.rememberSignons”, false);
pref(“general.config.obscure_value”, 0);
pref(“general.config.filename”, “mozilla.cfg”);
pref(“privacy.clearOnShutdown.history”, false);
pref(“privacy.clearOnShutdown.offlineApps”, true);
pref(“privacy.clearOnShutdown.passwords”, true);
pref(“privacy.clearOnShutdown.siteSettings”, true);
pref(“privacy.donottrackheader.enabled”, true);
pref(“privacy.sanitize.migrateFx3Prefs”, true);
pref(“privacy.sanitize.sanitizeOnShutdown”, true);

Note the reference to the Mozilla.cfg above!

The contents of the Mozilla.cfg:

// Prefs
lockPref(“browser.startup.homepage”, “”);
lockPref(“network.proxy.type”, 4);
lockPref(“app.update.enabled”, false);
pref(“browser.privatebrowsing.autostart”, true);
pref(“network.negotiate-auth.trusted-uris”, “”);
pref(“plugins.load_appdir_plugins”, true);
pref(“pdfjs.previousHandler.alwaysAskBeforeHandling”, true);
pref(“plugin.disable_full_page_plugin_for_types”, “application/pdf”);
pref(“pdfjs.migrationVersion”, 1);
pref(“pdfjs.previousHandler.preferredAction”, 4);
pref(“pdfjs.disabled”, true);

The Mozilla.CFG is very useful, as it allows you to use the lockPref option. This will grey out the setting to stop the user(s) from playing. it is worth bearing in mind that originally these fields were case-sensitive. I don’t know if they still are, but something to bear in mind.

Copy and paste the Mozilla.cfg into the root of the Firefox install folder as per below:

The Mozilla.CFG, in it's natural environment.

The Mozilla.CFG, in it’s natural environment.

Pop the Browser-Custom.JS into the “Firefox install folder”\defaults\pref as per below:

This file was originally shipped with Firefox.

This file was originally shipped with Firefox.

In general, if a setting doesn’t seem to have applied, try it in the other file.

Finally the profiles.ini. If configured correctly, you can set Firefox to have a roaming profile. The contents of the profiles.ini:



…by redirecting the Firefox profile to a network drive, wherever you have said network drive, you’ll have your Firefox profile. Obviously you can adapt this to a USB location too. Put the profiles.ini into the Firefox folder under the appdata location, as per below:

This new profile.ini will let your Firefox profile roam!

This new profile.ini will let your Firefox profile roam!

For the sake of package size, I delete the Firefox profile which was generated from our first launch. It’s not necessary, but I like to keep things tidy.

The only drawback to this is, if there is no access to the profile location, then Firefox will error. You will also need to think about how the Firefox profile gets created, as this won’t happen automatically. You could use a Group Policy Preference, however I went for a basic Powershell script. It checks to see if the folder exists, and creates one if it does not:

if (Test-Path U:\fire_pro)
$result = “Firefox Profile exists!”
$(MkDir “U:\fire_pro”).Attributes = ‘Hidden’

One thing to bear in mind, and this is something I keep forgetting to do, is to add the Powershell script to the sequence before you save it! There is a specific location for scripts, under the Package Files tab:

Don't forget the script. Like I always do.

Don’t forget the script. Like I always do.

If you recall I earlier mentioned about ticking the box to have the browser as default even though we don’t use it as a default browser. At this point I remove the file type associations. It may seem convoluted, but I recall someone stating that if you don’t tick the box, any future key changes won’t register.

You’ll then have to edit the DeploymentConfig.XML to include the following, assuming you call your Powershell script fire_pro.ps1:

<StartVirtualEnvironment  RunInVirtualEnvironment=”false”>
-file .\fire_pro.ps1
<Wait RollbackOnError=”false”/>

…and that’s pretty much it! When you next launch Firefox, it should obey one’s will.


Flame on xD

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s