Audio currentSrcProperty
Examples
Get the URL address of the current audio:
var x = document.getElementById("myAudio").currentSrc;
xThe output result is:
http://www.w3cschool.cc/try/demo_source/horse.ogg
Try it Yourself »
Definition and Usage
The currentSrc property returns the URL of the current audio.
If no audio is set, an empty string is returned.
Note:This property is read-only.
Tip:UsesrcProperty Set the URL address of the audio file.
Browser Support
![]()
![]()
![]()
![]()
![]()
All mainstream browsers support the currentSrc property.
Note:Internet Explorer 8 and earlier IE versions do not support this property.
Syntax
audioObject.currentSrc
Technical Details
| Return Value: | A string representing the URL of the current audio. Returns the entity URL, including the protocol (e.g., http://). If no audio is set, an empty value is returned. |
|---|
Audio Object
Other Extensions