[问题] 判断iframe是否加载完成

楼主: tas72732002 (葱头)   2015-12-06 09:30:54
请问一下各位, javascript 或 jquery 可否等判断iframe加载完毕, 程式如下
#file.php
<iframe src="http://127.0.0.1/demo.php" frameborder="1" id="do" name="do">
</iframe>
<script>
$('#do').on('load', function(){
console.log('load the iframe ... ')
});
</script>
#demo.php
<body onload = "document.getElementById('FORM').submit();">
<form action="demo_1.php" name="demo" name="FORM" id="FORM">
<input type="submit" name="b1" style="display:none">
</form>
</body>
#demo_1.php
<? header('Location: http://127.0.0.1/demo_2.php'); # 转址到demo_2.php ?>
demmo_2.php
<?
sleep(5); # 睡5秒
echo "demo_2_end";
?>
所以程式流程是 : file.php
作者: qwer820404 (GB2)   2015-12-06 19:34:00
感觉上透过onload是做不到的 如果透过window.parent在demo_2 echo完 使用window.parent 让父页知道载完这方法你可以试试

Links booklink

Contact Us: admin [ a t ] ucptt.com