开发者

Javascript Iframe Inject to beginning of <body> tag

开发者 https://www.devze.com 2023-04-06 01:54 出处:网络
Does anyone know if there is a way to add a iframe directly under the <body> tag?I see the appendChild but that does it before </body>.Any suggestions will be helpful.

Does anyone know if there is a way to add a iframe directly under the <body> tag? I see the appendChild but that does it before </body>. Any suggestions will be helpful.

Also, I doubt there is a way. But the website that is inside the iframe. Is it possible to have there drop downs, hover beyond the restricted iframe?

   ifrm = document.createElement("IFRAME"); 
   ifrm.setAttribute("src", "http://example.com"); 
   ifrm.style.width = "100%"; 
   ifrm.style.height = "30px"; 
   docume开发者_如何学运维nt.body.appendChild(ifrm); 


document.body.insertBefore(ifrm, document.body.childNodes[0]);


Anywhere (in HTML) that you are allowed to have a <body> element allows exactly one <body> element and nothing else. Thus, you cannot have an <iframe> as a sibling to a <body>.

0

精彩评论

暂无评论...
验证码 换一张
取 消