Alternative to HTML5 iframe srcdoc



The srcdoc attribute specifies the HTML content of the page to show in the iframe. The HTML <iframe> tag is used to create an inline frame.

Alternative of the srcdoc attribute will be:

var doc = document.querySelector('#demo').contentWindow.document;
var content = '<html></html>';

doc.open('text/html', 'replace');
doc.write(content);
doc.close();
Updated on: 2020-01-29T10:14:05+05:30

677 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements