HTMLIFrameElement.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

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
srcdoc
20
79
25
No
15
6
≤37
25
25
14
6
1.5

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/srcdoc