Skip to main content

Microsoft Silverlight

Answered Question Two ways of putting silverlight in a pageRSS Feed

(0)

bertpu
bertpu

Member

Member

72 points

69 Posts

Two ways of putting silverlight in a page

Hello,

I saw two ways of putting silverlight in a page.

One way is to use a object tag like this:

  <object data="data:application/x-silverlight," type="application/x-silverlight-2-b1" width="100%" height="100%">
   <param name="source" value="ClientBin/Test.xap"/>
   <param name="onerror" value="onSilverlightError" />
   <param name="background" value="white" />
    <a href="http://go.microsoft.com/fwlink/?LinkID=108182" style="text-decoration: none;">
        <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
   </a>
  </object>

 The other is to use script manager and silverlight control:

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div  style="height:100%;">
            <asp:Silverlight ID="Xaml1" runat="server"
                Source="~/ClientBin/LessonPlayer.xap" Version="2.0" Width="320px"
                Height="278px" />

 What is the difference between the two ways?

Thanks.

 

texmex5
texmex5

Contributor

Contributor

2239 points

382 Posts

Re: Two ways of putting silverlight in a page

There is also a third option - use createSilverlight() from Silverlight.js

I haven't used ASP a lot so I cannot comment on that alot, but I think there probably isn't a big difference, if at all.

But consirning JavaScript vs. object tag I can say the following.

  1. Using createSilverlight() function results with same outcome as the object tag but:
    • you have to include the Silverlight.js file, its not big but it still has an effect on your bandwith.
    • the default behaviour of IE is that if you add a Silverlight application with object tag, IE blocks it as a possibly malicious ActiveX component. You don't have this problem when using JavaScript.

Also have a look at these documents from msdn:

Hope this helps.

sladapter
sladapter

All-Star

All-Star

17439 points

3,172 Posts

Answered Question

Re: Two ways of putting silverlight in a page

No major difference. The second method is only for ASPX page. The ASPX page will use that asp:Silverlight .Net object to generate the HTML code like that in your first method. So basically you still get the same object tag in your page.

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities