Source type attribute

Definition and usage

type Set or return the value of the type attribute in the <source> element.

<source> type attribute Define the MIME type of media resources.

See also:

HTML referencer:HTML <source> tag

Example

Return the MIME type of the media resource:

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

Try it yourself

Syntax

Return the type attribute:

sourceObject.type

Set the type attribute:

sourceObject.type = MIME_type

Attribute value

Value Description
MIME_type

Define the MIME type of media resources.

Common MIME types:

For video:

  • video/ogg
  • video/mp4
  • video/webm

For audio:

  • audio/ogg
  • audio/mpeg

Se IANA MIME-typer, få en fuldstændig liste over standard MIME-typer.

Tekniske detaljer

Returværdi: Strengværdi, der angiver medieressourcens MIME-type.

Browsertilpasning

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Relaterede sider

HTML referencer:HTML <source> type egenskab