English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
HTML: The <object> tag is used as a container to embed external resources into HTML documents, such as audio, video, Flash, PDF, external applications, or browser plugins. Due to compatibility issues, the <object> tag is more commonly used to embed resources than the <embed> tag. This tag is also commonly referred to as the <object> element.
Use the <object> element to add a Flash file to HTML:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Basic Tutorial Website(oldtoolbag.com)</title> </head> <body> <object type="application/x-shockwave-flash" src="bookmark.swf" width="400" height="300"></object> </body> </html>Test and see ‹/›
IEFirefoxOperaChromeOpera
Chrome
Currently, most browsers support the <object> tag.
Tag definition and usage instructions
Define an embedded object. Use this element to add multimedia to your XHTML page. This element allows you to specify the data and parameters of the object to be inserted into the HTML document, as well as the code that can be used to display and operate the data.
<object> tag is used to include objects, such as images, audio, video, Java applets, ActiveX, PDF, and Flash.
object's original intention was to replace img and applet elements. However, due to vulnerabilities and lack of browser support, this was not achieved./browser's object support depends on the object type. Unfortunately, mainstream browsers use different code to load the same object type.
Fortunately, the object object provides a solution. If the object element is not displayed, the code located between <object> and <5object> code. In this way, we can nest multiple object elements (each corresponding to a browser). 4.01Compared to the <embed> tag, the <object> tag is more commonly used to embed external resources because the <object> tag is closely related to HTML
with HTML 4.01 Some differences in HTML5 Attributes in HTML
"form" is not supported in HTML.5 Newly defined attributes.
In HTML5 In HTML, objects can be submitted within a form.
In HTML5 In HTML, objects no longer appear within the <head> element area.
Attribute | Value | Description |
---|---|---|
align | top bottom middle left right | HTML5 Not supported. HTML 4.01 Deprecated. Specifies the alignment of the <object> element relative to surrounding elements. |
archive | URL | HTML5 Not supported. A space-separated list of URLs pointing to archive files. These archive files contain resources related to the object. |
border | pixels | HTML5 Not supported. HTML 4.01 Deprecated. Specifies the border width around the <object> element. |
classid | class_ID | HTML5 Not supported. Defines the ID value of a class embedded in the Windows Registry or at a URL, this attribute can be used to specify the location of the object included in the browser, usually a Java class. |
codebase | URL | HTML5 Not supported. Defines where the code required by the object can be found, providing a base URL. |
codetype | MIME_type | HTML5 Not supported. The MIME type of the code referenced by the classid attribute. |
data | URL | Specifies the URL of the resource used by the object. |
declare | declare | HTML5 Not supported. Defines that the object can only be declared and cannot be created or instantiated until the object is applied. |
formHTML5 | form_id | Specifies one or more forms to which the object belongs. |
height | pixels | Specifies the height of the object. |
hspace | pixels | HTML5 Not supported. HTML 4.01 Deprecated. Specifies the left and right margins of the object. |
name | name | Specifies a name for the object. |
standby | text | HTML5 Not supported. Defines the text to be displayed while the object is loading. |
type | MIME_type | Specifies the MIME type of the data specified in the data attribute. |
usemap | #mapname | Specifies the name of the client-side image map to be used with the object. |
vspace | pixels | HTML5 Not supported. HTML 4.01 Deprecated. Specifies the top and bottom margins of the object. |
width | pixels | Specifies the width of the object. |
<object> tag supports global attributes, see the complete attribute table HTML Global Attributes.
<object> tag supports all HTML Event Attributes.
HTML Tutorial:HTML Object Element