HTML iframe srcdoc property
Examples
A srcdoc attribute with the <iframe>:
<iframe srcdoc="<p>Hello world!</p>" src="demo_iframe_srcdoc.htm"></iframe>
try it"
Browser Support
Note: srcdoc property only supports Chrome and Safari 6 <iframe> tag.
Definition and Usage
To display attribute specifies srcdoc including HTML content in an inline frame page.
Tip: This property should be used in conjunction with the sandbox and seamless attributes.
If the browser supports srcdoc property, and specifies the srcdoc property, it will overwrite the contents of the src attribute specified.
If your browser does not support srcdoc property, and specifies the srcdoc property, it displays the file in the src attribute specified.
Differences between HTML 4.01 and HTML5
srcdoc attribute is new in HTML5 attributes.
grammar
<iframe srcdoc="HTML_code">
Property Value
值 | 描述 |
---|---|
HTML_code | 要显示在 iframe 中的 HTML 内容。必需是有效的 HTML 语法。 |
HTML <iframe> tag