Html code as IFRAME source rather than a URL

You can use srcdoc attribute to include HTML Code to Iframe.

<iframe srcdoc="<html><body>Hello, <b>world</b>.</body></html>"></iframe>

For JSF as htmlCode is the code as String
<iframe srcdoc="${bean.htmlCode}"></iframe>

If your HTML contains double quotes, consider escaping its double quotes

Hagy egy választ

Discover more from Velislav Krastev Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading