1

I was playing with a page that I am trying to put on to work for the community builder. The page uses the lightgallery library, to open up a popup gallery for some photos.

I verified that now the Community Builder supports the VF pages. If I am not wrong, initially they were supported only in the App Builder, for the Salesforce Lightning Experience.

After doing some testing, I found out, that the lightgallery plugin, works without any problem in a regular VF Page, but when I try to put it inside a Community Page, via Community Builder, that plugin simply doesn't work anymore.

Before going into dettails about that, I am trying to figure out what are the limits of this feature for the moment:

  • Should we be aware of any limitation regarding this scenario(what might be the best practice in this case)?
  • How will be treated the 3rd party JS libraries called from withing a VF Page, used in a Community Template?

Thanks, E.

3
  • What version of jQuery are you using with lightgallery? Are you writing a Lightning Component that uses lightgallery? Is lightgallery stored in a static resource in you org? Feb 16, 2017 at 17:20
  • To answer to your questions, I am using jQuery 2.2.4, and yes, the lightgallery library is uploaded as a static resource. The trouble is that when I test the Lightning App, the gallery works, though with some rendering problems. But when I add the component to my Community Template, the plug in, simply doesn't work. For your convenience, here is the link of the unmanaged package with the necessary components to repro the case: login.salesforce.com/packaging/… Feb 17, 2017 at 15:32
  • Follow-Up: Thought of this approach after I coudn't make the gallery work with a pure Lightning Bundle. I have explained my troubles regarding this approach, in this post here: salesforce.stackexchange.com/questions/160319/… Feb 17, 2017 at 15:34

1 Answer 1

1

First to be clear Locker only applies to Lightning Components so unless you are authoring an LC that uses lightgallery Locker is not involved.

Locker applies to LC's regardless of where they are being used. There are some container specific differences in Content Security Policy - for example Visualforce and Communities have a more permissive CSP policy for connect-src and script-src mostly the result of legacy support. If we were releasing Visualforce today it would have the same CSP as Lightning/Locker requires enforces - the XSS elimination benefits are huge among other things. I would recommend that you always develop and test in the least permissive container (a Lightning .app) to insure that your component will operate correctly in all containers.

2
  • So, if I understood well, if I have a component legacy as follows: Ligthning Component <- (iFrame)VF Page, the Locker Service will be enforced for all the VF components(JS Libraries, Page scripts etc.), because it is part of a larger container which is a Lightning Component? Feb 17, 2017 at 15:38
  • No - Locker is applied only to the javascript/markup that is created by Lightning Components - it will not reach into legacy technology managed javascript or DOM elements. Mar 1, 2017 at 10: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.