English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Referenzhandbuch

Vollständiges HTML-Tag-Verzeichnis

HTML: <iframe> srcdoc-Eigenschaft

Die srcdoc-Eigenschaft gibt an, welche HTML-Inhalte im Inline-Frames angezeigt werden sollen. Die srcdoc-Eigenschaft sollte zusammen mit den sandbox- und seamless-Eigenschaften verwendet werden.

 HTML <iframe> Tag

Online-Beispiel

Ein <iframe> mit der srcdoc-Eigenschaft:

<!DOCTYPE html>
<html>
<head>
<title>HTML: <iframe> srcdoc-Eigenschaft - 基础教程网 oldtoolbag.com</title>
<body>
<iframe srcdoc="<p>Hello world!</p>/p>" src="demo-iframe.html">
  <p>Ihr Browser unterstützt keine iframes.</p>/p>
</iframe>
</body>
</html>
Test See ‹/›

Browser Compatibility

The numbers in the table indicate the first browser version number that supports the attribute.

Attribute




srcdoc20.0Not Supported25.06.0 15.0

Definition and Usage

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

Tip:The srcdoc attribute should be used with the sandbox and seamless attributes.

If the browser supports the srcdoc attribute, it will override the content specified in the src attribute (if it exists).
If the browser does not support the srcdoc attribute, it will display the file specified in the src attribute (if it exists).

HTML 4.01 and HTML5differences between

The srcdoc attribute is an HTML5 new attributes added.

Syntax

        <iframe srcdoc="HTML_code">

Attribute Value

ValueDescription
HTML_codeHTML content is displayed in iframe. It must be valid HTML syntax.
 HTML <iframe> Tag