Redimensionner iFrame par javascript
Bonjour,
J'ai trouv� un script qui me permet de redimensionner une iframe automatiquement dans ma page web. Jusque l� tout marchait bien et je me suis rendu compte qu'en fonction du contenu de certaines pages la iframe ne se redimensionnait pas comme il faut (IE7) ou plus (IE6)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
<div id="aideMvt">
<iframe id="objectAideMvt" src="http://intra62.in.ac-lille.fr/spark/aidemvt/etablissement.php"
scrolling="no"
marginwidth="0"
marginheight="0"
frameborder="0"
vspace="0"
hspace="0"
style="overflow:visible; width:100%;"
onload="setTimeout('resize()',5000);">
</iframe>
</div>
<script type="text/javascript">
var iframe = document.getElementById("objectAideMvt");
var Window = iframe.window?iframe.window:iframe.contentWindow; /* Switch --> si IE iframe.window // si FF iframe.contentWindow */
function resize() {
try {
iframe.style.height = Window.document.body.offsetHeight+"px"; // IE6, FF, SAFARI
} catch (e) {
iframe.style.height = iframe.document.body.offsetHeight+"px"; // OPERA et autres
}
}
</script> |
Je me suis dit que �� vient surement du fait que ma page n'�tait pas fini d'�tre charg�e, j'ai donc mis un setTimeout mais �� ne change rien.