Why is Silverlight 1 broken with Firefox 3 and how do I fix it?

Why is Silverlight 1 broken with Firefox 3 and how do I fix it?

  • Comments 6

Firefox 3 is about to be released. There is a launch party this Sunday in the US and next Thursday in Barcelona.

The original V1 Silverlight detection script Firefox 3 has a race condition that affects the way that <object is invoked, loaded and detected. This race condition in the script has always been there but didn't occur in previous versions of the Firefox browser which meant that it remained updetected until late in the FireFox 3 development cycle.

What this means is that the forthcoming Firefox 3 release will break some Silverlight 1.0 installation experiences on web sites that use the original Silverlight 1.0 SDK Silverlight.js detection file.

The Silverlight 2 SDK has an updated Silverlight.js file that not only solves this problem for all versions of Silverlight but also eliminates browser restart that was previously needed for new installs.

You can get the SDK as part of the Install Silverlight Tools Beta 2 for Visual Studio 2008 or through the download center.

Silverlight Streaming will support hosting Silverlight 2 Beta 2 later this week.

Update: Silverlight Streaming now supports Silverlight 2 Beta 2

If you want to link to the Silverlight 2 Beta 2 Silverlight.js file hosted at Silverlight Streaming the one to use is http://agappdom.net/i/silverlight.js 

In the mean time I have uploaded just the new Silverlight 2 Beta 2 Silverlight.js detection file to skydrive.

Update: Alternatively the new Silverlight.js file that works with FF3 & Silverlight 1 & Silverlight 2B2 is now at http://code.msdn.microsoft.com/silverlightjs

Also you can now invoke Silverlight Streaming applications without using JavaScript at all. We support a URL syntax that directly names a self-contained web page with nothing but your Silverlight Streaming-hosted application.

You can use this URL as the source of an <iframe> tag to embed the application on sites that don’t allow JavaScript. Read more about this new feature in the SDK.

Piotr’s blog posts here and here also describe a technique that uses some simple javascript, to detect when Silverlight installation completes and launches the Silverlight content without any further user interaction or a browser restart.

Thanks,

Nigel

  • It's a race condition in Microsoft's Silverlight detection script, not Firefox. <object> loading has always been defined to be asynchronous so you shouldn't rely on methods like IsVersionSupported returning valid data when you call them immediately after starting the load.

  • Thanks Robert, I have updated the post now.

  • Thanks Nigel.

    BTW the behaviour change in Firefox occurred right at the start of the Gecko 1.9 development cycle --- in late 2005! So it's surprising, and unfortunate, that this wasn't noticed in time to fix the detection script before it was rolled out.

  • I understand that things have worked this way since Sep-2005 but that said if you run the following javascript in FireFox 2 it returns true 100% of the time when Silverlight is installed.

    <div id="a"></div>

    <script language="javascript" type="text/javascript">

    var a = document.getElementById('a');

    a.innerHTML='<object type="application/x-silverlight"  data="data:," />';

    var b=a.childNodes[0];

    alert(b.IsVersionSupported('1.0'));

    </script>

    Run it in FireFox 3 and it generates an error "b.IsVersionSupported is not a function".

  • Wait a minute, is this a client-side JS file or server-side? What do USERS (not developers) have to do to make it work with FF3.0?

  • @someone

    Although this is client-side JS it is up to the site owner to fix the .js file that is downloaded to the client. Users are unable to make these changes themselves to make Silverlight 1 sites work with FF3.

    I have sent off some internal emails to site owners of various large content sites (including microsoft.com, nba.com and mlb.com) but it will be up to them to make changes.

    In the meantime I recommend contacting the site owner of the site that is not working and continue to view those sites in FF2 until they are updated.

    An example of a site that works with Silverlight 1 and Firefox 3 is

    http://autotrader.co.nz/UsedItemDetails.aspx?Ne=220&N=221&item=124886&sid=11AA59BE121A click "Play Movie" below the image.

Page 1 of 1 (6 items)