Source type Property
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
The type property specifies the MIME type of the media resource.
Note:
Browser support





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 类型:
视频:
- audio/ogg
- audio/mpeg
Technical Details
| Return Value: | A string representing the MIME type of the media resource. |
|---|
Related Articles
HTML Reference Manual:HTML
The Source object