iframe srcdoc Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:iframe

Description

The srcdoc attribute sets the HTML content of the page to show in the inline frame which is expected to be used together with the sandbox and seamless attributes.

If a browser supports the srcdoc attribute, it will override the content specified in the src attribute if present.

If a browser does NOT support the srcdoc attribute, it will show the file specified in the src attribute instead if present.

Attribute Values

Value Description
HTML_code The HTML content to show in the iframe.

An <iframe> with a srcdoc attribute:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<iframe srcdoc="<p>Hello world!</p>" src="demo_iframe_srcdoc.htm">
  <p>Your browser does not support iframes.</p>
</iframe><!--  w  w  w  . ja  v  a 2  s  . c o m-->

</body>
</html>

Related Tutorials