I have read Is it possible to add iFrame directly in Lightning Components, this is not a duplicate. I need to display an iframe, but I cannot supply a
Briefly, I need to display
EmailMessage.htmlBody within my component, but the emails are coming from Outlook (via 3rd party syncing tool), so the email content includes
style tags. The client wants to keep the formatting, so I don't want to strip out the
ui:outputRichText strip out a number of tags including
style. Further, the way they strip them out leaves some of the
xmlns:xxx attributes from the
html tag present in the display, so they won't work.
I've looked at how the OOB EmailMessage view page in LEX works, and it's showing the email body inside an iframe... complete with all of the outlook-generated tags inside the iframe. But, there's no
src tag on the iframe, so I assume they are loading the iframe from JS.
I've tried the following:
- Direct setting, e.g.,
iframe.contentDocument.write(html). The wrapper object api doesn't expose contentDocument.
data:url, with the email body base64 encoded. CSP restriction doesn't allow Data urls. The CSP settings in SF allow for additional urls, but do not support the
data:scheme (per the error message when I tried).
blob:url, creating the Blob in js using the email body. No CSP error, and if I debug the
blob:url and paste it in the browser, I see the email body. But when I set it in the iframe in the page, I get a blank iframe. Inspecting the iframe content in chrome dev tools shows a simple empty html doc that isn't the content I put in my
So I'm stuck. How can I render the full html which I have as an object property, but not as an url, inside an iframe, in a Ltng Component?