srcdoc

The srcdoc property of the HTMLIFrameElement specifies the content of the page.

Examples

var iframe = document.createElement("iframe");
iframe.srcdoc = `<!DOCTYPE html><p>Hello World!</p>`;
document.body.appendChild(iframe);

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'HTMLIFrameElement: srcdoc' in that specification.
Living Standard  

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
srcdocChrome Full support 43Edge No support NoFirefox Full support 25IE No support NoOpera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support 18Firefox Android Full support 25Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown