I try to add CRM javascript web resource and try to manage iframe elements, but iframe OnReadyStateComplete event is not fired. Below, the first alert works but the second does not.
function hello()
{
var audioPath= Xrm.Page.data.entity.attributes.get("new_audiopath").getValue();
//var myAudio = document.createElement('audio');
//myAudio.setAttribute('src', audioPath);
// myAudio.play();
var IFrame = Xrm.Page.ui.controls.get("IFRAME_Play");
alert(audioPath);
//var myAudio =Xrm.Page.ui.controls.get("audioSource");
IFrame.OnReadyStateComplete=function(){
alert('iframe ready');
}
}