+ Start a Discussion
James KeoghJames Keogh 

trying to use JS in lightning:container

Hi All,

I am trying to create a twitter feed component for use in Salesforce communities and because I need to use the JS supplied by Twitter I am using a Lightning:container, however I cannon't seem to get the JS to load for me and I have been trying for days.

I have created an index.html file and zipped that up with the "widgets.js" file supplied by Twitter and saved it to the static resources in a file called spptest. I have also whitelisted twitter in the community CSP. Please see my code below and If you can spot any issues with it please let me know.

Thanks, James

HTML
<!DOCTYPE html>
    <html>
    <body>
    <a class="twitter-timeline" href="https://twitter.com/TwitterDev?ref_src=twsrc%5Etfw">Tweets by TwitterDev</a>
    </body>
    </html>

CMP
<aura:component implements="forceCommunity:availableForAllPageTypes, flexipage:availableForAllPageTypes" access="global">
        <lightning:container src="{!$Resource.spptest + 'index.html'}"/>
        <aura:attribute name="TwitterHandle" type="String" />

    </aura:component>

Design
<design:component label="Twitter Feed 2.0">
        <design:attribute name="TwitterHandle" label="Twitter Handle" description="Please insert the Twitter handle you would like to display" />
        <design:supportedFormFactors>
            <design:supportedFormFactor type="Large"/>
            <design:supportedFormFactor type="Small"/>
        </design:supportedFormFactors>
    </design:component>

This is the result I get when the component is in the community:
User-added image
Naveen KNNaveen KN
Did u check for any errors in the browser console?

--
Naveen K N