Scott Hanselman

Firefox, ClickOnce, XBAPs and .NET 3.5 SP1

September 5, '08 Comments [3] Posted in ASP.NET | BabySmash | Musings | Tools | Windows Client | WPF
Sponsored By

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...

Picture of the Firefox Addins dialog

And its options dialog looks like this:

image

On my system the Firefox UserAgent now looks like this:

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.1) 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. 

.NET Assistant FFClickOnce Result
No Prompt Prompt FFClickOnce prompts and handles the click
No Prompt No Prompt FFClickOnce handles the click
Prompt Prompt

.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:
http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul

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.

isClickOnce: function()
{
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")
{
return true;
}

return false;
},


launch_application: function()
{
this.execute(this.getSystem32Dir() + \\PresentationHost.exe,
"-LaunchApplication " + dialog.mLauncher.source.spec);

dialog.mDialog.close();
}

It's not too complex, and it's sure nice that BabySmash users can use ClickOnce to launch the smash.

XBAP

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.

Image of the NPWPF.dll that enables XBAPs

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:

The about:plugins page in Firefox 

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.

Related Links

Technorati Tags: ,

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Sunday, September 07, 2008 2:24:46 AM UTC
Sunday, September 07, 2008 2:25:18 AM UTC
On grate upgrade.
Monday, September 08, 2008 2:36:13 AM UTC
I noticed a couple of you Msoftie's blogging about xbaps lately. I am hoping it is not because SL 2 RTW is way behind and that you are trying to find a stop gap solution. I hope it is just to give those who want the full .net framework and find that SL does not deliver everything. I have been actively teaching myself Silverlight and enjoying it however have found some of what is in full wpf and .net 3.5 not there when I wanted to use it and hence the solution would be to use an xbap.

I understand that the size of the silverlight plugin must be small and that is a key goal at MS. But I just find it funny that MS are making it tiny not just small. I would be making an assumption but I would think that most pc's out there have adobe reader loaded which is 35MB and seems to take forever to install IMO. Then there is quicktime probably not installed as much as reader it is 22MB. The Sun Java VM is 15MB (offline install). Flash is interesting the adobe website has it as a 1.5MB download, which is tiny, but I don't think SL should compete with Flash they are in seperate races, once again IMO.

Anyway I am one user\developer who would not mind taking a little larger once off hit to have more functionality. I am not talking full functionality such as 3D just a little more on the data and controls side.

I am just voicing my opinion just to get that out there. As for firefox a quarter of my clients run Linux and therefore I want to push SL to the limit (don't worry they are all running MS servers)
Steve
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.