Udostępnij za pośrednictwem


Property Values of the HTML Object Element

Microsoft Silverlight will reach end of support after October 2021. Learn more.

This topic describes properties of the DOM-level object element that are relevant for programming the Silverlight plug-in.

Property Values of the Object Tag

The following is a list of the properties of the object element that are relevant to Silverlight features, to Silverlight-based applications, or to APIs that are used to program Silverlight-based applications.

NoteNote:

This list does not include properties of the object element that are not relevant to the Silverlight plug-in. For more information about additional properties of the object element, see the Document Object Model (DOM) Level 1 Specification on the W3C Web site.

Property

Description

classid, codebase, codetype, code, archive

Not typically used for a Silverlight plug-in object element. Silverlight uses type to specify a MIME type for its codebase.

type

Identifies the Silverlight plug-in codebase. This should be set to the following value:

application/x-silverlight-2

data

Not used by most browsers for Silverlight purposes. However, setting a value for this property can help prevent decreased performance on some browsers. For this reason, the following value for the data property is recommended:

data:application/x-silverlight-2,

NoteNote:
The trailing comma is part of the property value.

width

Specifies the initial width of the Silverlight plug-in area in the HTML page. Can be as a pixel value or as a percentage (a value that ends with the % character specifies a percentage value). For example, "400" specifies 400 pixels, and "50%" specifies 50% (half) of the available width of the browser content area. For more information, see the Remarks section of this topic.

height

Specifies the initial height of the Silverlight plug-in area in the HTML page. Can be set either as a pixel value or a percentage (a value that ends with the % character specifies a percentage value). For example, "300" specifies 300 pixels, and "50%" specifies 50% (half) of the available height of the browser content area. For more information, see the Remarks section of this topic.

altHtml

Provides content that provides fallback cues such as download and installation information for Silverlight. We recommend that you do not specify altHtml as an attribute. Instead, provide this value as inner HTML for the object element. This technique is equivalent to providing an altHtml attribute value and gives you HTML that is easier to read. 

tabIndex

Specifies the tab index for the object element. This attribute is compatible with a Silverlight object element. However, Silverlight has an internal accessibility model that incorporates a tab sequence.

id, style, etc.

Specify general behavior of the object element. These attributes are possible on a Silverlight object element, depending on how you construct the hosting HTML page and on the overall HTML support.

culture, uiculture

Specifies the culture settings that are used to retrieve satellite assemblies. For more information, see Localizing Silverlight-based Applications.

Remarks

The height and width properties of the Silverlight object element determine the content area that is available for your application in the browser host. If you set height and width to a value that is smaller than any height and width values in your Silverlight page (such as the Height and Width of the UserControl root for a managed Silverlight page), the content might be clipped. If you leave Height and Width unspecified on the UserControl object, the page is sized to the size that is determined by the browser and by the height and width setting of the Silverlight object element.