We have a requirement to fire an api and show the response using Lightning components. XSLT transformation has to be done on the response to get the actual content. As it is not possible to use XSLT with salesforce, we have used html5 iframe in the lightning component.

Is iframe preferable in lightning component ? Plase suggest any alternatives if iframe is not preferable.


The use of an iframe is the recommended approach:

In those situations, we recommend that you put code that needs access to external resources in a “worker iframe” using Visualforce. The technique looks something like this.

<aura:component ...>
    <aura:attribute name="message" type="String"/>
    <aura:attribute name="vfHost" type="String"/>
    <!-- Input field for message "data" -->
    <lightning:input type="text" label="Message:"
    <lightning:button label="Send to Visualforce"
    <!-- The Visualforce page to send data to -->
    <iframe aura:id="vfFrame"
     src="{!'https://' + v.vfHost + '/apex/myvfpage'}"/>

XSLT can also be done via MuleSoft, but that may be overkill.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.