DOM Interfaces
HTMLIFrameElement
Represents an embedded browsing context with navigation, sandbox and document-access properties. Cross-origin content is restricted by the same-origin policy. Avoid assigning untrusted HTML to srcdoc without an appropriate trust boundary. Example result: 0.
Formal Syntax & Structure
html syntaxhtml
const element = document.getElementById('demo'); // HTMLIFrameElementReturn Value
HTMLIFrameElement
An existing HTML DOM object associated with the iframe element in this example; this interface is a type, not a function return contract.
Working Example
Example Snippethtml
iframe id="demo" title="Example" sandbox srcdoc="<p>Local</p>"></iframe><p> Result: <output id="result"></output></p><script> const e = document.getElementById('demo'); const result = value => { document.getElementById("result").textContent = String(value); }; result(e.sandbox.length);</script>