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

Legg igjen et svar

Oppdag mer fra Velislav Krastev-bloggen

Abonner nå for å fortsette å lese og få tilgang til hele arkivet.

Fortsett å lese