Audio currentSrc attribute
Example
Get the URL of the current audio:
var x = document.getElementById("myAudio").currentSrc;
x
The output is:
http://www.w3cschool.cc/try/demo_source/horse.ogg
Try it »
Definition and Usage
The currentSrc attribute returns the URL of the current audio.
If no audio is set, an empty string is returned.
Note: This attribute is read-only.
Tip: Use src Attribute: sets the URL of the audio file.
Browser support





All major browsers support the currentSrc attribute.
Note: Internet Explorer 8 and earlier IE versions do not support this attribute.
Syntax
audioObject
.currentSrc
Technical Details
| Return Value: | String representing the URL of the current audio. Returns the actual URL, including the protocol (e.g. http://). If no audio is set, an empty value is returned. |
|---|
Audio object