contentWindow iframe crm 2016

2019-10-07 17:30发布

please find below the code where I am trying to access a Webresource. I am working on CRM 2016

var xyz= window.xyz|| {};

$("#WebResource").contentWindow.xyz.Scheduler.load();

Gives out "Unable to get property 'contentWindow' of undefined or null reference" message.

Need help.

2条回答
三岁会撩人
2楼-- · 2019-10-07 17:57

As already pointed out; manipulating the DOM directly is unsupported. However, if you're doing this purely for debugging purposes from the F12 console you can prepend your calls to the Xrm object as follows:

var webResource = frames[0].Xrm.Page.getControl("WebResource_Name");
var content = webResource.getObject().contentWindow.document;

Note that the specific frame containing the form does move around sometimes depending on which form you're looking at so if frames[0] doesn't work, try frames[1] instead.

查看更多
We Are One
3楼-- · 2019-10-07 18:16

Don't manipulate the DOM, it's unsupported.

Do this

Xrm.Page.getControl("WebResource").getObject().contentWindow.[etc. etc.]

查看更多
登录 后发表回答