Open In App

HTML | srcdoc Attribute

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

The HTML srcdoc attribute is used to specify the HTML content of the page to show in the inline frame. This attribute is anticipated to be used beside the sandbox and seamless attributes. 
If a browser supports the srcdoc attribute, it’ll override the content laid out in the src attribute (if present). 
If a browser doesn’t support the srcdoc attribute, it’ll show the file laid out in the src attribute instead (if present).

Supported tag:  

Attribute Values

  • HTML_code: It is used to specify the HTML content of the page which will display in an Iframe element.

Example: 

html highlight=7

Output: 

Supported Browsers: The browsers supported by HTML srcdoc Attribute are listed below: 

  • Google Chrome 20.0 and above
  • Edge 79.0 and above
  • Firefox 25.0 and above
  • Internet Explorer not supported
  • Opera 15.0 and above
  • Safari 6.0 and above

Last Updated : 21 Jun, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads