2

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

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.

  • Yes, I'm trying to use lightning:container but I'm running into 404 ... how to fix that? – Surya Chandra Rao Gandreddi May 1 '18 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 '18 at 8:06

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.