Iframe to infinity

2019-01-20 11:38发布

If I have an HTML page, and in it I have an iframe that loads the page the iframe is on within it...

What will happen?

标签: html iframe
2条回答
啃猪蹄的小仙女
2楼-- · 2019-01-20 12:15

nothing will happen due to restrictions. (the browser ain't -that- stupid anymore)

查看更多
放我归山
3楼-- · 2019-01-20 12:21

For most browsers - as in Mozilla, Webkit et al. - nothing will happen because eventually there is a limit on the iframe nesting depth. Also any iframe with its SRC being set to the exact URL used by one of its parents will be treated to have no SRC URL at all (the iframe renders as a blank frame - as shown in the fiddle from the above comment: http://jsfiddle.net/tze8x/1/).

BUT for Internet Explorer different rules apply... If you add a simple iteration number as a query string to the nested iFrame's src IE - and we also tested this with the latest IE version 10 - just crashes :)

this.php

<html>
<head></head>
<body>
<iframe src="this.php?q=<?php echo (isset($_GET['q'])?$_GET['q']:1)+1?>" />
</body>
</html>
查看更多
登录 后发表回答