contentWindow iframe crm 2016

前提是你 提交于 2019-12-13 09:42:45

问题


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.


回答1:


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

Do this

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




回答2:


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.



来源:https://stackoverflow.com/questions/40220751/contentwindow-iframe-crm-2016

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!