Search code examples
javascriptiframedynamics-crmdynamics-crm-2015

OnReadyStateComplete is not fired


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');
     }
    }

Solution

  • I had similar problem, but only with iframe content from other domians. I think it's the security restrictions, not allowing to raise events. We worked around it with a aspx-page on the server, which downloaded the content, and recreated it for the xrm script.