简体   繁体   中英

How to replace iframe in IE9

Is there a way with javascript to replace an iframe, for example

<iframe id="myframe"></iframe>

with a link like this...

<a href="">go here</a>

only if browser detects IE9? If I write a pure javascript code from my <head></head> area. I want this action to occur before the iframe is fully loaded onto the page.

You can use conditional comments to target IE 9 and write a script to change out the iframe . Or you can try to use the conditional comment to select which tag gets displayed directly.

<!--[if IE 9]>
<a href="">go here</a>
<![endif]-->
<!--[if !IE]> -->
<iframe id="myframe"></iframe>
<!-- <![endif]-->

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM