I need a solution for auto-adjusting the width
and height
of an iframe
to barely fit its content. The point is that t
If the content is just a very simple html, the simplest way is to remove the iframe with javascript
HTML code:
Javascript code:
function removeIframe(obj) {
var iframeDocument = obj.contentDocument || obj.contentWindow.document;
var mycontent = iframeDocument.getElementsByTagName("body")[0].innerHTML;
obj.remove();
document.getElementsByClassName("iframe")[0].innerHTML = mycontent;
}