I'd like to show a lightning component on a public Force.com Site. I've created a lightning app and put my component into the app. Then I added it into my Visualforce page.

Lightning App:

<aura:application description="PrivacyPageApp" access="GLOBAL" implements="ltng:allowGuestAccess" extends="ltng:outApp">
    <aura:dependency resource="RGDPR:PrivacyPage" />

Visualforce Page:

<apex:page standardStylesheets="false" showHeader="false" sideBar="false" cache="false">
    <apex:includeLightning />

    <div id="lightningComponent" />

        $Lightning.use("RGDPR:PrivacyPageApp", function() {
                    leadContactId: '{!$CurrentPage.parameters.id}',
                    pageId: '{!$CurrentPage.parameters.pageId}'
                function(component) {


I enabled Community. Must I create any community?

Empty Community

But when I go to my Visualforce page I get an error message in Chrome console:

enter image description here

How to make it work for Force.com sites?


You don't need to create a community for this.

You need to create one site (setup -> site -> New). In Active Site Home Page you need to select your VF page name. To create a site, first you need to have a domain name.

I was able to create it by just copy-pasting your code with the exception of using default namespace (c:)

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.