Audio src attribute
Definition and usage
src
attribute sets or returns the audio The <audio> src attribute value.
src
The attribute specifies the location (URL) of the audio file.
Example
Get the URL of the audio file:
var x = document.getElementById("myAudio").src;
Syntax
Return the src attribute:
audioObject.src
Set the src attribute:
audioObject.src = URL
Attribute value
Value | Description |
---|---|
URL |
Specifies the URL of the audio file. Possible values:
|
Technical Details
Return Value: | A string value representing the URL of the audio file. Returns the entire URL, including the protocol (such as http://). |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
All mainstream browsers support the src attribute. However, not all browsers support the defined file formats.
Related Pages
HTML Reference Manual:HTML <audio> src Attribute