locked
OnReadyStateComplete Not Firing RRS feed

  • Question

  • I have an IFrame in my CRM 2011 on-premises with the following settings:

    URL: about:blank
    Pass record object-type code and unique identifier as parameter: NOT checked
    Restrict cross-frame scripting, where supported: NOT checked
    Visible by default: checked
    Event: OnReadyStateComplete, Function = SetURL, Enabled = checked

    However, when I open the account OnReadyStateComplete never fires. I also changed the function name to SetURL1 (which does not exist) but there is no error. When I click in the IFrame and select Properties I see that the URL is set to about:blank, i.e. the initial URL. Why does OnReadyStateComplete not fire and how can I get it to fire?

    Tuesday, May 20, 2014 8:25 PM

Answers

  • The docs say that it fires when the I frame is ready for dom manipulation. If there is no dom. As in the case of about.blank. try point the I frame url to a literal page.
    • Marked as answer by hfaun Sunday, June 22, 2014 12:35 AM
    Wednesday, June 18, 2014 6:47 AM
  • Donald, I think that is exactly the issue. Microsoft does give the example with about.blank, though. The problem is that the IFrame loads asynchronously which according to Microsoft can cause the URL to be overwritten. So far from my testing this has not happened so I will be taking that approach for now.  
    • Marked as answer by hfaun Sunday, June 22, 2014 12:35 AM
    Sunday, June 22, 2014 12:35 AM

All replies

  • OnReadyStateComplete fires when the IFrame has finished loading -> http://msdn.microsoft.com/en-us/library/d88d5f21-6385-443b-91f2-0ec0c16b1324#BKMK_IFRAMEOnReadyStateCompleteEvent

    CRM is probably looking for an HTTP Status Code of 200.   Since there is no URL, there wont be a 200, and no OnReadyStateComplete event.

    [UPDATE]

    According to this post  the about:blank should work.  I'll test it out tomorrow.

    • Edited by Eric Labashosky Monday, June 9, 2014 10:10 PM found new information
    Monday, June 9, 2014 10:04 PM
  • The last solution in that thread is pretty much what I did but it didn't work. I suspect that because nothing is loaded (blank) the event never fires. Then again, the solution in that thread is also was Microsoft says should be done. Did it work for you?
    Monday, June 16, 2014 7:24 PM
  • The docs say that it fires when the I frame is ready for dom manipulation. If there is no dom. As in the case of about.blank. try point the I frame url to a literal page.
    • Marked as answer by hfaun Sunday, June 22, 2014 12:35 AM
    Wednesday, June 18, 2014 6:47 AM
  • Donald, I think that is exactly the issue. Microsoft does give the example with about.blank, though. The problem is that the IFrame loads asynchronously which according to Microsoft can cause the URL to be overwritten. So far from my testing this has not happened so I will be taking that approach for now.  
    • Marked as answer by hfaun Sunday, June 22, 2014 12:35 AM
    Sunday, June 22, 2014 12:35 AM