srcdoc attribute can be used (instead of the
src attribute) to specify the exact contents of the iframe as a whole HTML document. This will yield an IFrame with the text "IFrames are cool!"
<iframe srcdoc="<p>IFrames are cool!</p>"></iframe>
srcdoc attribute isn't supported by the browser, the IFrame will instead fall back to using the
src attribute, but if both the
srcdoc attributes are present and supported by the browser,
srcdoc takes precedence.
<iframe srcdoc="<p>Iframes are cool!</p>" src="base.html"></iframe>
In the above example, if the browser does not support the
srcdoc attribute, it will instead display the contents of the