ລັກສະນະ HTML <iframe> srcdoc
Definition and Usage
srcdoc
Attribute specifies the HTML content of the page to be displayed in the inline frame.
Tip:This attribute is expected to work with sandbox
and seamless
attribute together.
If the browser supports srcdoc
attribute, it will override the content specified in the src attribute (if it exists).
If the browser does not support srcdoc
If the attribute is set, it will display the file specified in the src attribute (if it exists).
Example
iframe with srcdoc attribute set:
<iframe srcdoc="<p>Hello world!</p>" src="demo_iframe_srcdoc.html"></iframe>
Syntax
<iframe srcdoc="HTML_code">
Attribute Value
Value | Description |
---|---|
HTML_code | HTML content displayed in iframe. It must be valid HTML syntax. |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
20.0 | 79.0 | 25.0 | 6.0 | 15.0 |