English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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.
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 ‹/›
The numbers in the table indicate the first browser version number that supports the attribute.
Attribute | |||||
---|---|---|---|---|---|
srcdoc | 20.0 | Not Supported | 25.0 | 6.0 | 15.0 |
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).
The srcdoc attribute is an HTML5 new attributes added.
<iframe srcdoc="HTML_code">
Value | Description |
---|---|
HTML_code | HTML content is displayed in iframe. It must be valid HTML syntax. |