0

I tried to include an html file inside Salesforce lightning container which will run our react js app.

I believe I missed some setting. We could directly access the static resource but it showing nothing on the lightning community page.

    <lightning:container
            src='/portal/resource/portal_resource/index.html'

            onmessage="{!c.handleMessage}"
            onerror="{!c.handleError}"/>

    <lightning:container
            src='/resource/portal_resource/index.html'
            onmessage="{!c.handleMessage}"
            onerror="{!c.handleError}"/>

    <lightning:container
            src='resource/portal_resource/index.html'
            onmessage="{!c.handleMessage}"
            onerror="{!c.handleError}"/>

inline

Community URL: https://portal-dev-community-developer-edition.na53.force.com/portal/s/

Static resource : https://portal-dev-community-developer-edition.na53.force.com/portal/resource/PortalApp/index.html

    <lightning:container
            aura:id="PortalApp"
            src="resource/PortalApp/index.html"
            onmessage="{!c.handleMessage}"
            onerror="{!c.handleError}"/>
    <lightning:container
            aura:id="PortalApp"
            src="/portal/resource/PortalApp/index.html"
            onmessage="{!c.handleMessage}"
            onerror="{!c.handleError}"/>
0

Try this. The communities site is a different domain. It may not like the relative URI. The $Resource global variable should get around that.

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

You could also try

src='/{your-community-page-name}/resource/portal_resource/index.html'
  • None of your solutions works. It's so strange and odd. Is there any security setting that we need to update it? portal-dev-community-developer-edition.na53.force.com/portal/s – Dummy Oct 4 '18 at 21:14
  • Hmm. Well that stinks! :P Are you logged in as a community user, or are you accessing the page as the Guest User? – Shane Steinfeld Oct 4 '18 at 21:16
  • Ooh -- better question: What's your static resource? Is it a zip file, or just an HTML file? – Shane Steinfeld Oct 4 '18 at 21:17
  • Appreciate your update. I'm accessing as internal/guest/community users. None of them could see the content. As you can see. You could directly access my static resource, isn't it? Any thought? – Dummy Oct 4 '18 at 22:23
  • What have you uploaded to your static resource? Is it a zip file? An html file on its own? Let's make sure it isn't a path issue! – Shane Steinfeld Oct 4 '18 at 23:33

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.