Hello world!

" src="demo_iframe_srcdoc.htm"> ``` --- ## Browser Support The numbers"> Hello world!

" src="demo_iframe_srcdoc.htm"> ``` --- ## Browser Support The numbers" />
Easy Tutorial
❮ Tag Ul Att Frameset Cols ❯

HTML <iframe> srcdoc Attribute

HTML <iframe> Tag

Example

An <iframe> with the srcdoc attribute:

<iframe srcdoc="<p>Hello world!</p>" src="demo_iframe_srcdoc.htm"></iframe>

Browser Support

The numbers in the table specify the first browser version that fully supports the attribute.

Attribute
srcdoc 20.0 Not supported 25.0 6.0 15.0

Definition and Usage

The srcdoc attribute specifies the HTML content of the page to show in the inline frame.

Tip: This attribute should be used together with the sandbox and seamless attributes.

If the browser supports the srcdoc attribute and the srcdoc attribute is specified, it will override the content specified in the src attribute.

If the browser does not support the srcdoc attribute and the srcdoc attribute is specified, it will display the file specified in the src attribute.


Differences Between HTML 4.01 and HTML5

The srcdoc attribute is new in HTML5.


Syntax

Attribute Values

Value Description
HTML_code The HTML content to be displayed in the iframe. Must be valid HTML syntax.
❮ Tag Ul Att Frameset Cols ❯