English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The src attribute specifies the location of the audio file (URL), to make it work in all browsers- Use the <source> element within the <audio> element. The <source> element can link to different audio files. Browsers will use the first recognized format.
Play Audio:
<!DOCTYPE html> <html> <title>HTML:<audio> src Attribute - Basic Tutorial Website oldtoolbag.com</title> <body> <audio src="horse.ogg" controls> Your browser does not support the audio element. </audio> </body> </html>Test and see ‹/›
IEFirefoxOperaChromeSafari
Internet Explorer 9+, Firefox, Opera, Chrome, and Safari browsers all support the src attribute. However, not all browsers support the audio file format.
Note: IE and Safari do not support the .ogg file format.
Note: Internet Explorer 8 and earlier IE versions do not support the <audio> tag.
The src attribute specifies the location of the audio file (URL).
The example above uses Ogg format audio files and will run in Firefox, Opera, and Chrome.
To play audio files in Internet Explorer and Safari, we must use MP3file.
to work in all browsers- within the <audio> element<source>Element. The <source> element can link to different audio files. Browsers will use the first recognized format.
<!DOCTYPE html> <html> <title>HTML:<audio> src Attribute - Basic Tutorial Website oldtoolbag.com</title> <body> <audio controls> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> Your browser does not support the audio tag. </audio> </body> </html>Test and see ‹/›
The <audio> tag is part of HTML5Newly added.
<audio src="URL">
Value | Description |
---|---|
URL | Specifies audio/URL of the video source. Possible values:
|