Answers for "javascript create iframe"

8

html iframe example

<iframe src="http://www.codegrepper.com"></iframe>
Posted by: Guest on June-26-2019
0

document.createElement('iframe');

var ifrm = document.createElement('iframe');
ifrm.setAttribute('id', 'ifrm'); // assign an id

//document.body.appendChild(ifrm); // to place at end of document

// to place before another page element
var el = document.getElementById('marker');
el.parentNode.insertBefore(ifrm, el);

// assign url
ifrm.setAttribute('src', 'demo.html');
Posted by: Guest on December-22-2020
0

put html in iframe

<iframe srcdoc="<html><body>Hello, <b>world</b>.</body></html>"></iframe>
Posted by: Guest on December-18-2020
0

js set iframe code

var html_string= "content";
document.getElementById('output_iframe1').src = "data:text/html;charset=utf-8," + escape(html_string);
Posted by: Guest on September-01-2021

Browse Popular Code Answers by Language