iframe嵌套情况下的self实例页面

回到相关文章 »

效果:

iframe外:self === parent    // 

代码:

HTML代码-iframe页面:
<pre>iframe内:self === parent    // <span id="result" class="green"></span></pre>
<script>
document.getElementById('result').innerHTML = (self === parent);
</script>
                
HTML代码-主页面:
<pre>iframe外:self === parent    // <span id="result" class="green"></span></pre>
<script>
document.getElementById('result').innerHTML = (self === parent);
</script>