Html 代码作为 IFRAME 源而不是 URL

您可以使用 srcdoc 属性将 HTML 代码包含到 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>

如果你的 HTML 包含双引号, 考虑 转义双引号

发表回复