3

lightning:container gives 404 error, but iframe loads fine :(

<lightning:container aura:id="Cont" src="{! $Resource.StaticResource1 + '/index.html'}" />

<iframe aura:id="Cont" src="{! $Resource.StaticResource1 + '/index.html'}" /> 

index.html

<!DOCTYPE html>

<html>

<head>
  <meta charset="utf-8">
  <title>Container</title>
</head>

<body>
  From ... Container.
</body>

</html>

Any suggestions, what I'm doing wrong.

Thanks

==> It is so strange, when I create another static resource with the same index.html it works fine !!!!!!!

1
  • I have right now same dobut... do you know the solution? Sep 20, 2021 at 15:49

1 Answer 1

1

The "Lightning Container Component Isolation" section of the LockerService and Lightning Container Component: Securely Using Third-Party Libraries in Lightning Components suggests that lightning:container is the way to go though is not explicit about the LockerService blocking a raw iframe.

And the src attribute is listed for iframe in Locker Service API Viewer as being available...

Personally I'd just use the lightning:container.

2
  • Yes, I'm trying to use lightning:container but I'm running into 404 ... how to fix that? May 1, 2018 at 7:37
  • @SuryaChandraRaoGandreddi Its easy to get the ZIP content wrong e.g. accidentally introducing an extra root folder; it sounds like perhaps that was the problem all along. Sorry about my answer - I mitread the question.
    – Keith C
    May 1, 2018 at 8:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .