para ajustar o iframe à altura do conteúdo
<script language="JavaScript">
function autoResize(id){
alert('check');
var newheight;
var newwidth;
if(document.getElementById){
newheight=document.getElementById(id).contentWindow.document .body.scrollHeight;
newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth;
}
alert(newheight);
alert(newwidth);
document.getElementById(id).height= (newheight) + "px";
document.getElementById(id).width= (newwidth) + "px";
}
</script>
HTML:
<iframe id="faq_iframe" src="http://www.google.com" width="100%" height="200px" scrolling="no" frameborder="0" marginheight="0" onload="javascript: autoResize('faq_iframe');"></iframe>
Pergunta, questão: Estou usando o iframe para exibir minha página. Preciso ajustar o iframe à altura da minha página. Como posso fazer isso.
Eu tinha tentado códigos acima
eu recebi esse erro via firebug
Permission denied for <http://localhost> to get property Window.document from <http://www.google.co.in>.
[Break On This Error] newheight=document.getEleme...tWindow.document.body.scrollHeight;
Como fazer com que o iframe se ajuste à altura da minha página fornecida no iframe src