How to Embed Silverlight in HTML
Silverlight is a new development platform from Microsoft for creating rich media applications for the Web and desktop and mobile operating systems. As a free platform, it works on the .NET framework and is expanded with user plug-ins. Embedding Silverlight in the HTML code of a web page makes use of the OBJECT tag and PARAM child element. Silverlight must be installed on the user's computer for the plug-in embedded to work. Using HTML comments, users who do not have Silverlight installed receive a message to download the platform for free.
Instructions
-
-
1
Open your web page's HTML file in a text editor by clicking on "File" and "Open." Any text editor will do however, but comes with Notepad and Mac OS comes with Text edit. These applications are found under Accessories and Applications respectively.
-
2
Place the OBJECT tag and PARAM child element between the BODY tags of the web page according to Microsoft's specifications. For example:
<object width="300" height="300"
data="data:application/x-silverlight-2,"
type="application/x-silverlight-2" >
<param name="source" value="SilverlightApplication1.xap"/>
</object>Change the value of the PARAM child element to the name of the Silverlight plug-in you want to embed.
-
-
3
Add an HTML comment to point users to download Silverlight if it is not installed on their computers. The comment as provided by Microsoft looks like this:
<object id="SilverlightPlugin1" width="300" height="300"
data="data:application/x-silverlight-2,"
type="application/x-silverlight-2" >
<param name="source" value="SilverlightApplication1.xap"/><!-- Display installation image. -->
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50401.0"
style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376"
alt="Get Microsoft Silverlight"
style="border-style: none"/>
</a></object>
The comment must be after the PARAM child element and before the OBJECT end tag.
-
4
Save the file.
-
1
References
- Photo Credit BananaStock/BananaStock/Getty Images