Source typeProperty
Examples
Return the MIME type of the media resource:
var x = document.getElementById("mySource").type;
xThe output result is:
audio/mpeg
Try it Yourself »
Definition and Usage
The type property sets or returns the value of the type attribute of the <source> element.
The type attribute specifies the MIME type of the media resource.
Note:The <source> element is new in HTML5.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the type property.
Syntax
Return the type property:
sourceObject.type
Set the type property:
sourceObject.type=MIME_type
Property Values
| Value | Description |
|---|---|
| MIME_type | Specifies the MIME type of the media resource. Common MIME types: Video:
|
Technical Details
| Return Value: | A string, representing the MIME type of the media resource. |
|---|
Related Articles
HTML Reference Manual:HTML <source> type Attribute
Other Extensions
Source Object