X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Source type Property

Source Object Reference Source Object

Example

Return the MIME type of a media resource:

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

The result of x will be:

audio/mpeg

Try it yourself »


Definition and Usage

The type property sets or returns the value of the type attribute in a <source> element.

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

Note: The <source> element is new in HTML5.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The type property is supported in all major browsers.


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:
For video:
  • video/ogg
  • video/mp4
  • video/webm
For audio:
  • audio/ogg
  • audio/mpeg
Look at IANA MIME types for a complete list of standard MIME types

Technical Details

Return Value: A String, representing the MIME type of the media resource


Related Pages

HTML reference: HTML <source> type attribute


Source Object Reference Source Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook