web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

iFrame onReadyStateComplete Issue in CRM online

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Community Member Profile Picture
    on at

    Microsoft might be changed the security features with this update. As you know, these types of errors can occur when it comes from other domain. It might be due to the cross- domain issues.

    Mansoor

  • Community Member Profile Picture
    on at

    You might be right we the security issues Mansoor ... but it can't be a cross domain issue when i'm showing an html webressource on the same domain.

  • Community Member Profile Picture
    on at

    Can you please post the sample code which you are using in handler ?

  • Community Member Profile Picture
    on at

    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.

  • Community Member Profile Picture
    on at

    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>

  • Community Member Profile Picture
    on at

    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

  • Community Member Profile Picture
    on at

    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

  • Community Member Profile Picture
    on at

    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

  • Community Member Profile Picture
    on at

    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?

  • Community Member Profile Picture
    on at

    Nobody there who is able to help? Nobody there with the same Problem?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans