IFrame causing javascript code to not execute

Posted by Claudio Redi on Stack Overflow See other posts from Stack Overflow or by Claudio Redi
Published on 2010-03-31T18:30:34Z Indexed on 2010/03/31 18:33 UTC
Read the original article Hit count: 341

Filed under:
|
|

Does anyone know why this code doesn't work. This means, the alert is NOT fired

<iframe/>
<script type="text/javascript">alert('hello');</script>

While this code with the alert BEFORE the Iframe works perfeclty. This means the alert is fired

<script type="text/javascript">alert('hello');</script>
<iframe/>

Seems that no javascript placed after the iframe is executed, I don't find any logic to this.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html