- HTML Tutorial
- HTML - Home
- HTML - Introduction
- HTML - Editors
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Headings
- HTML - Paragraphs
- HTML - Fonts
- HTML - Blocks
- HTML - Style Sheet
- HTML - Formatting
- HTML - Quotations
- HTML - Comments
- HTML - Colors
- HTML - Images
- HTML - Image Map
- HTML - Iframes
- HTML - Phrase Elements
- HTML - Meta Tags
- HTML - Classes
- HTML - IDs
- HTML - Backgrounds
- HTML Tables
- HTML - Tables
- HTML - Headers & Caption
- HTML - Table Styling
- HTML - Table Colgroup
- HTML - Nested Tables
- HTML Lists
- HTML - Lists
- HTML - Unordered Lists
- HTML - Ordered Lists
- HTML - Definition Lists
- HTML Links
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML Color Names & Values
- HTML - Color Names
- HTML - RGB
- HTML - HEX
- HTML - HSL
- HTML Forms
- HTML - Forms
- HTML - Form Attributes
- HTML - Form Control
- HTML - Input Attributes
- HTML Media
- HTML - Video Element
- HTML - Audio Element
- HTML - Embed Multimedia
- HTML Header
- HTML - Head Element
- HTML - Adding Favicon
- HTML - Javascript
- HTML Layouts
- HTML - Layouts
- HTML - Layout Elements
- HTML - Layout using CSS
- HTML - Responsiveness
- HTML - Symbols
- HTML - Emojis
- HTML - Style Guide
- HTML Graphics
- HTML - SVG
- HTML - Canvas
- HTML APIs
- HTML - Geolocation API
- HTML - Drag & Drop API
- HTML - Web Workers API
- HTML - WebSocket
- HTML - Web Storage
- HTML - Server Sent Events
- HTML Miscellaneous
- HTML - MathML
- HTML - Microdata
- HTML - IndexedDB
- HTML - Web Messaging
- HTML - Web CORS
- HTML - Web RTC
- HTML Demo
- HTML - Audio Player
- HTML - Video Player
- HTML - Web slide Desk
- HTML Tools
- HTML - Velocity Draw
- HTML - QR Code
- HTML - Modernizer
- HTML - Validation
- HTML - Color Picker
- HTML References
- HTML - Cheat Sheet
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
- HTML Resources
- HTML - Quick Guide
- HTML - Useful Resources
- HTML - Color Code Builder
- HTML - Online Editor
HTML - srcdoc Attribute
HTML srcdoc attribute specifies the HTML content on the page to show in the inline frame.
If the srcdoc attribute is present in the <iframe> element, then it will override the content specified in the src attribute. If the srcdoc attribute is not present in the <iframe> element, then it will show the file specified in the src attribute.
It can be used together with sandbox and seamless attribute.
Syntax
<tag srcdoc="HTML_code" >
HTML_code: It is used to specify the HTML content of the page which will display in an iframe element.
Applies on
Below-listed element allows the use of the HTML srcdoc attribute.
Element | Description |
---|---|
<iframe> | HTML <iframe> tag is used to create an inline frame. |
Examples of HTML srcdoc Attribute
Below examples will illustrate the HTML srcdoc attribute, where and how we should use this attribute!
Using srcdoc attribute with "iframe" Tag
Content provided in srcdoc attribute is seen in output window.
<!DOCTYPE html> <html> <head> <title>HTML iframe srcdoc Attribute</title> </head> <body> <h1>HTML iframe srcdoc Attribute</h1> <iframe srcdoc="<p>Hi, I am tutorialspoint. I provide easy learning tutorials. Have a happy learning experience.</p>" height="100" width="300"> </iframe> </body> </html>
Override content of src Attribute using srcdoc
Content in srcdoc replaces the tutorialspoint website given in src attribute.
<!DOCTYPE html> <html> <body> <h3>HTML srcdoc Attribute</h3> <strong>Normal Iframe</strong> <br> <iframe src= "https://tutorialspoint.com/html/html_overview.htm" height=400 width="500"> </iframe> <br> <strong>Normal Iframe</strong> <br> <iframe src= "https://tutorialspoint.com/html/html_overview.htm" srcdoc= "<p>We ere representing HTML Introduction Post</p>" height=400 width="500"> </iframe> </body> </html>
Supported Browsers
Attribute | |||||
---|---|---|---|---|---|
srcdoc | 20.0 | 79.0 | 25.0 | 6.0 | 15.0 |
html_attributes_reference.htm
Advertisements
To Continue Learning Please Login
Login with Google