Latest web development tutorials

HTML DOM Source type property

Source Object Reference Source Object

Examples

Returns the MIME type of property:

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

x The output is:

audio/mpeg

try it"

Definition and Usage

type property sets or returns the value of the type property <source> element.

type attribute specifies the MIME type of property.

Note: <source> element is new in HTML5.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the type attribute.


grammar

Returns type attributes:

sourceObject .type

Setting type attributes:

sourceObject .type=MIME_type

Property Value

描述
MIME_type 规定媒体资源的 MIME 类型。

常见的 MIME 类型:
视频:
  • video/ogg
  • video/mp4
  • video/webm
音频:
  • audio/ogg
  • audio/mpeg
请参阅 IANA MIME 类型 ,获得标准 MIME 类型的完整列表。

technical details

return value: String representing the MIME type of property.


related articles

HTML Reference Manual: HTML <Source> of the type attribute


Source Object Reference Source Object