O'Reilly logo

Facebook Cookbook by Jay Goldman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required