Audio src Property
Example
Get the URL of an audio file:
var x = document.getElementById("myAudio").src;
Try it Yourself »
Description
The src property sets or returns the value of the src attribute of an audio.
The src attribute specifies the location (URL) of the audio file.
Browser Support
Property | |||||
---|---|---|---|---|---|
src | Yes | Yes | Yes | Yes | Yes |
The src property is supported in all major browsers. However, the file format defined may not be supported in all browsers.
Syntax
Return the src property:
audioObject.src
Set the src property:
audioObject.src = URL
Property Values
Value | Description |
---|---|
URL |
Specifies the URL of the audio file. Possible values:
|
Technical Details
Return Value: | A String, representing the URL of the audio file. Returns the entire URL, including the protocol (like http://) |
---|
Related Pages
HTML reference: HTML <audio> src attribute
❮ Audio Object