简体   繁体   中英

How to access IFrame's content window from CRM 2016 form

I am trying to access Iframe content window from crm 2016 form using the below syntax:

var Rkn= window.Rkn|| {};   
    $("#WebResource")[0].contentWindow.RKN.Scheduler.load();

But I am getting Unable to access content window error. I used the below alternative as well

Xrm.Page.getControl("#WebResource").getObject().contentWindow.RKN.Scheduler.load();

But I am getting Unable to access getObject or null reference error. Any help is appreciated.

The second way you're trying is correct and the supported way, except you shouldn't use the # (that's part of the JQuery selector for finding by id). You can look up the webresource name in the form designer like so:

在此处输入图片说明

So assuming your webresource name was WebResource_MailingRecipients you could access the contentWindow of the IFRAME via:

Xrm.Page.getControl("WebResource_MailingRecipients").getObject().contentWindow

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM