3

I was trying my hands on lightning:container. I created a normal html page and tried inside lightning:container.

Code: home.html uploaded as static resource named home

<html>
    <head>

    </head>

    <body>
        MyBody
    </body>

</html>

and then in my lightning:component

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <lightning:container src="{!$Resource.home}" />
</aura:component>

When I demo this, it shows nothing on screen, but in console I can see error log:

enter image description here

I first thought its CSP issue, so i added Lightning domain URL in CSP list, still, it couldn't load. Has anyone managed to get lightning:container working?

Source: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_lightning_container.htm

  • Are you on Summer 18 orgs ? I just tried in my scratch orgs and it works as expected . – Mohith Shrivastava May 25 '18 at 1:15
  • Hi @MohithShrivastava, even tried on Spring 18 sandbox, same issue. – Pranay Jaiswal May 25 '18 at 9:26
  • Did you upload the html file as is or in a zip ? – Fabien Taillon May 25 '18 at 10:01
  • @FabienTaillon i tried HTML directly, then I tried html inside a ZIP, I even added manifest file, but still same. – Pranay Jaiswal May 25 '18 at 10:05
  • 1
    I tried the exact same code, adding directly home.html in static resource home and it worked. Why did you get jquery error if you don't have any reference to jquery ? – Fabien Taillon May 25 '18 at 10:07
0

Try using...

lightning:container src="{!$Resource.home + '/index.html'}"

for more example please refer this link

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.