<h4>Create a new HTML Page Using the <code>DOMParser</code> API</h4>

<iframe src=""></iframe>
code{
	font-size: 13pt;
}

window.onload = () => {
  var parser = new DOMParser();
  var doc = parser.parseFromString('<strong>Hello World! </strong>', "text/html");
  doc.body.append('extra text');
  var iframeDoc = document.querySelector('iframe').contentDocument;
  iframeDoc.replaceChild(doc.documentElement, iframeDoc.documentElement);
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.