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

9
  • Are you on Summer 18 orgs ? I just tried in my scratch orgs and it works as expected . May 25, 2018 at 1:15
  • Hi @MohithShrivastava, even tried on Spring 18 sandbox, same issue. May 25, 2018 at 9:26
  • Did you upload the html file as is or in a zip ? May 25, 2018 at 10:01
  • 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 ? May 25, 2018 at 10:07
  • 1
    Not sure if this is relevant but we just found out that LCC is not supported in a Community that is hosted on a custom domain. We found this out after our application worked fine in our sandboxes but wouldn't load in Production. Jul 29, 2020 at 20:40

1 Answer 1

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.