Is it posible to add iframe directly in lightning components?

Is it possible to add iframe directly in a lightning component as below to visible in community sites ?

<aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
    <iframe width="800" height="600" style="border: 1px solid" src="---" />
</aura:component> 

Answer

Its definitely possible to use an iframe inside the lightning component .The out of box Visualforce component also internally just iframes the Visualforce inside the lightning component .Even the new lightning:container does an iframe of the third party application inside the lightning component .

As the comment said if there are http and https urls are mixed you will get a mixed content error so to avoid it always use src value as an https URL .

Attribution
Source : Link , Question Author : Prasad Ruwanpathirana , Answer Author : Mohith Shrivastava

Leave a Comment