web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Access IFrame div text

(1) ShareShare
ReportReport
Posted on by 15

Hi all,

In dynamic crm , I have loaded iframe from other website and submit iframe form  but i am not able get success message from iframe div .

I have try following:


parent.Xrm.Page.getControl("WebResource_commonIframe").getObject().contentWindow.document.getElementById('content');

$("#WebResource_commonIframe").contents().find('body');

any above solution is not working

please suggest me any solution.

I have the same question (0)
  • cloflyMao Profile Picture
    25,210 on at

    Hi Jitendra,

    That's because web resource itself is also an iframe element.

    You could run code below to get iframe content in web resource:

    var webResourceContent = parent.Xrm.Page.getControl("WebResource_name").getObject().contentDocument;
    
    var iframeWebsite = webResourceContent.getElementsByTagName("iframe")[0];
    
    try {
    
      var innerDoc = iframeWebsite.contentDocument || iframeWebsite.contentWindow.document;
    
    } catch (e) {
    
      Xrm.Utility.alertDialog("An error has occured: "   e);
    
    }

    However, your "other website" might blocks external website to access its content from an iframe, such as bing.com

    pastedimage1576056392652v1.png

    Regards,

    Clofly

  • Suggested answer
    Pawar Pravin  Profile Picture
    5,237 on at

    Please try below code once:

    Xrm.Page.getControl("WebResource_commonIframe").getObject().contentDocument.getElementsByClassName("classnamehere")[0].value;
    
    or 
    
    Xrm.Page.getControl("WebResource_commonIframe").getObject().contentDocument.getElementById("Elementidhere")[0].value;
    

    In my case "getElementsByClassName" its working fine. 

  • Suggested answer
    Community Member Profile Picture
    on at

    Try this.

    var t = Xrm.Page.getControl("WebResource_mis_activityCalendar").getObject().contentDocument;
    $(t).contents().find("#refresh").trigger('click')

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 72 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 29 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans