Firefox, ClickOnce, XBAPs and .NET 3.5 SP1
One of the things that I noticed immediately when I made the SmallestDotNet was that Firefox was reporting the version of the .NET Framework installed. There's a Firefox extension that is installed with .NET 3.5SP1. I was stoked about this because I'd like users of BabySmash to be able to use ClickOnce from Firefox to launch it.
ClickOnce and Firefox
When you install .NET Framework 3.5SP1, there's a key written to the registry whether Firefox is installed or not. If Firefox is installed later, it will notice the key and use the plugin. If it's already installed, it'll just work. The registry key points to a Firefox Extension (XPI) that acts like the 3rd party FFClickOnce extension that a lot of us installed before.
The registry key is at HKLM:\Software\Mozilla\Firefox\Extensions This Firefox Addin helps ClickOnce applications work from inside of Firefox 2 or Firefox 3. It'll be installed with any installation of .NET 3.5 SP1, including the smaller Client Profile.
The add-in looks like this...
And its options dialog looks like this:
On my system the Firefox UserAgent now looks like this:
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:220.127.116.11) Gecko/2008070208 Firefox/3.0.1 (.NET CLR 3.5.30729)
By default, as you can see in the dialog, the browser will report just the most recent version of the .NET Framework unless you say otherwise.
What happens if the FFClickOnce extension is already installed?
In Firefox 3 the FFClickOnce add on will automatically get disabled as it has not been updated.
In Firefox 2 the FFClickOnce extension does not alter the user agent string due to a safeguard against creating a user agent greater than 128 characters. What happens when the user clicks on a .application link is dependent on the user’s configuration.
For Firefox 2.0 this is the table of possible prompting/launching configurations. The default for each add-on is marked in bold.
|No Prompt||Prompt||FFClickOnce prompts and handles the click|
|No Prompt||No Prompt||FFClickOnce handles the click|
.NET Assistant prompts and handles the click
|Prompt||No Prompt|| |
FFClickOnce handles the click
When both add-ons are in the default configuration the user will get the FFClickOnce prompt and click once activation will follow the FFClickOnce path which may bypass IE download policy. In all cases the normal ClickOnce UI will be shown.
What this all means is that ClickOnce will work in FireFox 2 and 3, whether FFClickOnce is installed or not.
How's it done?
The plugin is written with standard XUL (pronounced zoo-el) via XML and JS.
As an aside, I think it's cool that the XML namespace for XUL is:
You can go find the plugin yourself in:
C:\Windows\Microsoft.NET\Framework\v3.5\Windows Presentation Foundation\DotNetAssistantExtension
It's a .jar file, and you can copy it out and rename it .zip and open it up. The basic gist is that the plugin watches for a particular MIMEType and application, and if it matches, it launches the ClickOnce application using the the .NET Framework's PresentationHost.exe.
var mimeInfo = dialog.mLauncher.MIMEInfo;
// Checking the file extension may be second guessing the webserver
// but when 'prompt' is set the user will still have a save button.
if (mimeInfo.MIMEType == "application/x-ms-application" ||
mimeInfo.primaryExtension == "application")
this.execute(this.getSystem32Dir() + \\PresentationHost.exe,
"-LaunchApplication " + dialog.mLauncher.source.spec);
It's not too complex, and it's sure nice that BabySmash users can use ClickOnce to launch the smash.
XBAPs, or XAML Browser Applications are also enabled in Firefox in .NET 3.5 using the standard NPAPI browser plugin API. The NPWPF.dll enables XBAPs under Firefox.
XBAPs are WPF applications that run inside the Browser's Chrome. They're good for Intranet applications where you want really easy deployment, the complete .NET Framework (as opposed to Silverlight) and a browser's navigational model.
If you type in about:plugins in Firefox, you can get a list, including this one:
Notice the MIME Types that this plugin has registered for and the extensions (suffixes) it handles. Each of these plugins are automatically installed and enabled when you install the .NET Framework 3.5SP1, so you can count on them.
Thanks to Eric Harding, Troy Martez and Jennifer Lee for helping me pull this information together. They're going to be adding more content to the Windows Client website very soon with more details how for developers to package and use the .NET Client Profile. They'll also be releasing lots of documentation and details on ClickOnce and deployment improvements in the framework. I'll point you to everything I can dig up, Dear Reader, as soon as I can.
- Introduction to the Client Profile
- The .NET 3.5SP1 Client Profile
- Screencast on Deploying on .NET 3.5SP1