Since Update 1 for MS CRM 2015 online i've got an issue with the onReadyStateComplete events in iframes.
For testing i defined an almost empty html webresource which i placed in an Iframe on the contact form. When i open contacts i'll see this weppage correctly, but when i add a handler for onReadyStateComplete to the defined iframe and call a js method which does nothing else than just open an alert nothing happens when the content of the iframe is loaded (handler is for sure activated).
When i call the same js method from form onload everything works so ist not a problem with that simple javascript. Even switching to the old rendering engine won't fix my problem. In all cases it seems like that the event is not thrown (worked perfectly before update). Tried now many things to get that working again but up to now i have no clue. Security for the iFrame is set like before ... no restrictions on Overall Frame scripting (checkbox not set).
Hopefully somebody can help me with that problem.
*This post is locked for comments
Sorry ... haven't found any solution up to now ... switching to the old renderung engine doesn't help me either
Hi Sven - have you found any resolution to this issue yet? I am experiencing the same exact issue (I think) - see my post here:
http://stackoverflow.com/questions/32491243/onreadystatecomplete-does-not-fire-on-iframe
Nobody there who is able to help? Nobody there with the same Problem?
Think i should talk a bit more in Detail that you understand my Problem in our solution. I migrated a CRM 2011 onpremise to CRM 2015 online and the view for actvities in contact is not that was it has been before. So what is did was the following:
1) Deleted the old activities from the form
2) Inserted a new iframe with src about:blank
3) When the iframe ready Event appeared it called ajs method to set a new source in the iframe (Areas.apsx with certain Parameters i calculated) . This Event was fired when the Rendering engine was ready ... so that i was able to use Access to DOM and Change the src attribute of the iframe
4) What also happend was that i parsed the dom of that new view (Activities) to Change the filter to all instead of Default behaviorur (30 days) and that worked perfectly
The example above is just a simple Showcase where i was explaining that the readystatecomplete event is not fired by update 1. My webressource i defined in this example (the blank page) is now Areas.aspx with certain paremetern where i CAN'T add any JavaScript funtionality.
For sure i can use the form onload functionaliy of contact to set the source of the iframe here with
var iFrame = Xrm.Page.ui.controls.get("IFRAME_ActivitiesContact");
iFrame.setSrc(mycalculatedurl);
But as the page is still reandering i can't force any filter in the activities to be set (aynchronus). Therefore i needed that readystatecomplete event of the iframe witch is not fired anymore.
Do you understand what i mean?
you can add globalcontext reference to your html webresource and use your scripts.
<script src="../ClientGlobalContext.js.aspx" type="text/javascript"></script>
Simply add above to your html web resource to get context.
Mansoor
What i did was just to test issues ... before update i haven't even used the html webressource ... about:blank was also working for me
For sure i can do ... got then your "completed" message (as expected). Problem is ... i can't place my js code here because it is in a more global context
Hi,
Can you please do something like below in your html web resource.
<script type="text/javascript">
document.onreadystatechange = function () {
if (document.readyState == "complete") {
alert("Completed");
}
}
</script>
I'm using Standard funtionality. Added an iFrame to the contact form with name iFrame_test and URL https://....../WebResources/test_blankPage and scripting flag disabled to get around security issues if needed.
Content of the webressource test_blankPage is:
<html><head><meta charset="utf-8"></head><body><font face="Arial" size="1">Loading ...</font></body></html>
which was created by the normal WYSYWYG Editor.
When i save and publish this the webresource it is perfectly shown in the contact form. What i now want is that when content of the iframe is loaded (the webressource above) some JavaScript is executed.
In my example i added a js webressource with only one function
function showMessage() {
alert('iframe ready');
};
That also has been saved and published!
When you then go to the form properties add the above javasript webressource to your libraries and then add the eventhandler to call the method showMessage when the onload Event of the form is fired .... then the alert appears.
When you instead use the iframe_test as source control (instead of form) and you create a handler for doing the same stuff when the readystatecomplete Event is fired you won't see an alert appearing.
Nothing has really changed and before updating to "Update 1" it worked. But as i said ... it feels like having no event has been fired.
Can you please post the sample code which you are using in handler ?
André Arnaud de Cal...
292,160
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156