The src attribute on a <source> tag specifies the URL or path of a resource file.
This URL points to the media file to display or play.
A src attribute on two <source> elements.
Each source has a src attribute referencing different audio files.
<audio controls>
<source src="/media/epic.mp3" type="audio/mpeg">
<source src="/media/epic.wav" type="audio/wav">
</audio>
The src attribute specifies the URL or path of the resource file.
The URL points to the media file to display (images) or play (audio and video).
The browser uses the URL to locate and load the media file.
The URL can be internal (from same website) or external (another website).
<source src="URL" />
Value | Description |
---|---|
URL | URL or path of the resource file |
A video element with different file sources.
<video width="320" height="240" controls>
<source src="/media/movie.mp4" type="video/mp4">
<source src="/media/movie.ogg" type="video/ogg">
</video>
Here is when src support started for each browser:
Chrome
|
4.0 | Jan 2010 |
Firefox
|
3.5 | Jun 2009 |
IE/Edge
|
9.0 | Mar 2011 |
Opera
|
10.5 | Mar 2010 |
Safari
|
4.0 | Jun 2009 |