2

I have defined a web resource as follows:

function setIframe_OnLoad() {
    var iFrame = Xrm.Page.ui.controls.get('IFRAME_docmgmt');
    var url = iFrame.getSrc();
    if (url.indexOf("blank") != -1) {
        setiFrameUrl();
    }
}

function setiFrameUrl() {
    debugger;
    var url = 'http://www.google.com';
    Xrm.Page.getControl('IFRAME_docmgmt').setSrc(url);
}

And I have configured the url of an iframe named docmgmt to about:blank. I wired up the OnReadyStateComplete event of the iframe to the setIframe_OnLoad function. When I load my CRM 2013 form, the debugger line is hit and I can step through and see that the Xrm.Page.ui.controls.get('IFRAME_docmgmt').getSrc() value does indeed change to http://www.google.com. When the function completes, the page reloads. I don't know why. When it reloads, the iframe is set to about:blank again. Does anyone have a working code sample for setting an iFrame URL programmatically using javascript in Dynamics CRM 2013?

2
  • Is this all URLs? Have you tried https to avoid mixed mode? Commented Mar 14, 2014 at 1:24
  • Good point. It's actually not mixed, both are http Commented Mar 18, 2014 at 14:39

1 Answer 1

1

www.google.com wont work because next error:

Refused to display 'https://www.google.com.bo/?gws_rd=cr&ei=XZKQU6_YA6HNsQTkhIKIBA' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'. More references here.

So as the start page is set to about:blank this remains after .setSrc function. Actually there are many sites which does not allow use theirs webpages as iFrames.

I wrote same code that you but using http://www.bing.com and it is working pretty fine :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.