Embedding Microsoft Silverlight

Problem

I love using the latest and greatest technologies, so I’ve gone and built a kick-ass Silverlight movie that I want to embed into my app.

Solution

Use the fb:silverlight tag to embed your Silverlight objects. The simplest form is:

<fb:silverlight silverlightsrc="http://someserver.com/kickAss.xaml" />

Discussion

As with embedding Flash (see Embedding Adobe Flash), your Silverlight objects will play automatically when embedded on a Canvas page and will load and display the image specified in imgsrc when embedded in a Profile Box, which will require a click to start playing. The fb:silverlight tag shares some of the same optional parameters as fb:swf, and these are listed in Table 6-8.

Table 6-8. Parameters for fb:silverlight

Name

Type

Default value

Description

silverlightsrc

string

N/A

The URL of the Silverlight you want to embed. This is the only required field.

height

int

None

Height of your Silverlight, in pixels.

imgclass

string

None

CSS class to apply to the image specified in imgsrc.

imgsrc

string

spacer.gif

The image that will be shown in place of your Silverlight when it can’t be displayed or in places where the user needs to click to activate it (e.g., in Profile Boxes). The default value is http://static.ak.facebook.com/images/spacer.gif, which will render your Silverlight unusable in Profile Boxes since it will be invisible, so make sure you specify this if you want to embed it there.

imgstyle

string

None

Inline CSS styling for the image specified ...

Get Facebook Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.