Integrating Silverlight with a Web Page
Microsoft Silverlight will reach end of support after October 2021. Learn more.
You can embed the Silverlight plug-in in your Web page in one of two ways:
Using the HTML object element.
Using the Silverlight.js helper file.
The HTML object element is compatible with all supported Web browsers, and provides the basis for the Silverlight.js embedding technique. The Silverlight.js embedding functions ultimately generate HTML object elements, and expose all the features that the object element exposes. This common basis enables you to combine both embedding techniques.
In order to support Silverlight-based applications, your Web server must be configured to associate the .xap file name extension with the MIME type "application/x-silverlight-app". For IIS 7.0 or later, this value is pre-configured.
The following sections provide a brief overview of the available embedding and integration options. Each section includes links to topics with additional details.
The HTML object element is the simplest way to embed the Silverlight plug-in, and is the recommended way. This is the default approach that is used by Visual Studio when you create a new Silverlight-based application and choose to host it in a dynamically generated HTML page.
For more information, see How to: Add Silverlight to a Web Page by Using HTML.
For more information about upgrade scenarios, see ASP.NET Support for Silverlight.
Providing a Custom Installation and Upgrade Experience
The Silverlight project templates for Visual Studio currently provide a very simple default installation and upgrade experience. When you deploy your application, you should replace the default experience with a custom experience that will entice users to install Silverlight and run your application. For more information on providing this experience, see the Microsoft Silverlight Installation Experience White Paper and Sample Code.
For more information, see HTML Bridge: Interaction Between HTML and Managed Code.