Javascript Iframe Inject to beginning of <body> tag
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>
.
精彩评论