14

I try to use the lightning container to display an element in a salesforce component. So, I have this code :

<aura:component access="global">
    <lightning:container aura:id="timeline"
        src="{!$Resource.myProject+ '/index.html'}"/>
</aura:component>

But it doesn't work, the browser try to load the index.html file in the wrong address :

myaddress.container.lightning.com/lcc/1501081198000/myProject/index.html?sfdcIFrameOrigin=myaddress.lightning.force.com

whereas the file is at this address :

myaddress.lightning.force.com/resource/1501081198000/myProject/index.html

My index.html file is in the static resource folder.

So, do you know how I can do to take the file on the right folder or how I can choose the folder ?

4
  • Having the same issue. My LCC component has the right resource syntax according to the doc, but when rendering in the app, it shows a /lcc/path/to/resource.html in the iframe that doesn't resolve. Manually updating the iframe src in the rendered HTML to /resource/path/to/resource.html makes it render properly. Jul 28 '17 at 13:44
  • 1
    Guys, Im following developer.salesforce.com/docs/atlas.en-us.lightning.meta/… Realty App from Salesforce Official Documentation, but following the same steps as they are describing, I have Realty App blocked on Browser (Refused to display ... in a frame because it set 'X-Frame-Options' to 'sameorigin'. ) so official example doesn't work at all (working with API version 41). Oct 20 '17 at 11:24
  • 2
    Seeing the same X-Frame Options issue as well here.
    – pbattisson
    Oct 23 '17 at 8:30
  • Did someone fine any workaround for this?
    – Victor
    Mar 22 '18 at 23:39
5

Just one additinal information to the previous one:

If I try to load directly the html from the resolve URL without the lcc in the url like that:

<lightning:container aura:id="ReactApp"
                       src="https://pve-poc-dev-ed--c.container.lightning.com/lcc/1508416411000/schedulingComponentVisjs/index.html"
                       onmessage="{!c.handleMessage}"
                       onerror="{!c.handleError}"/>

I got this funny message from SF:

The src attribute must not begin with '/lcc/'. We received: /lcc/1508416411000/schedulingComponentVisjs/index.html
4

I have exactly the same problem, I'm not even able to make the Realty example to work. I can access to my index.html from https://pve-poc-dev-ed.lightning.force.com/resource/1508416411000/schedulingComponentVisjs/index.html but as lightning:container resolve the URL to the index.html inside the static resources to https://pve-poc-dev-ed--c.container.lightning.com/lcc/1508416411000/schedulingComponentVisjs/index.html, it doesn't work.

Here the piece of code I'm using to load the container

  <lightning:container aura:id="ReactApp"
                       src="{!$Resource.schedulingComponentVisjs + '/index.html'}"
                       onmessage="{!c.handleMessage}"
                       onerror="{!c.handleError}"/>
2

I had this issue at first, but then realized that the zip needed to be created at the same level as the index.html file, not the containing folder. For example:

Don't zip this whole folder

/ReactApp
  select all assets in here and make zip from that
  index.html
  manifest.json
  ... etc

Hope it helps someone :)

1
  • 1
    This did help me and it works. May 2 '19 at 0:54

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.