Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Source type Property

Source type Property

Source Object Reference The Source object

Example

Return the MIME type of the media resource:

var x = document.getElementById("mySource").type;

x The output is:

audio/mpeg

Try it »


Definition and Usage

The type property sets or returns the value of the type attribute of the element.

The type property specifies the MIME type of the media resource.

Note: The element is new in HTML5.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the type attribute.


Syntax

Return the type property:

sourceObject

.type

Set the type property:

sourceObject

.type=

MIME_type

Attribute values

Value Description
MIME_type Specifies the MIME type of the media resource.
 常见的 MIME 类型:       

 视频:     
  • video/ogg
  • video/mp4
  • video/webm
  • Audio: See [IANA MIME Types](http://www.iana.org/assignments/media-types/) for a complete list of standard MIME types. |

    Technical Details

    Return Value: A string representing the MIME type of the media resource.

    Related Articles

    HTML Reference Manual:HTML type Attribute


    Source Object Reference The Source object