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 :
Microsoft Dynamics CRM (Archived)

How to pass parameters to IFrame using javascript

(0) ShareShare
ReportReport
Posted on by 3,634

I've following code snippet to access http://localhost:80/testsite in IFRAME. It worked fine but as soon as I went to pass the fields value as parameter nothing get happen. I tried directly access the page from browser with parameters so page is behaving fine. I cannot figure out the things after spending a lot of time. I would like to seek your kind patience on this basic question.

code Snippet

function forwardValues(){
    var ordername = Xrm.Page.getAttribute("name").getValue();
    var IFrame = Xrm.Page.ui.controls.get("IFRAME_sendvalue");
    var Url = IFrame.getSrc();

    var params = Url.substr(Url.indexOf("?"));

    var param1 = Url+"?ordername="+ordername;

    IFrame.setSrc(param1);

}

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    sandeepstw Profile Picture
    4,601 on at

    hi,

    Iframe is just like a new window so you can pass parameter only by url querystring. Check this link can help you:

    stackoverflow.com/.../how-to-pass-parameters-through-iframe-from-parent-html

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Try to use following code:

    function forwardValues(){

       var ordername = Xrm.Page.getAttribute("name").getValue();

       var IFrame = Xrm.Page.ui.controls.get("IFRAME_sendvalue");

       var Url = IFrame.getSrc();

       if (Url.indexOf("?") != -1)

           Url = Url.substr(0, Url.indexOf("?"));

       var param1 = Url+"?ordername="+ordername;

       IFrame.setSrc(param1);

    }

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans