klewis
klewis

Reputation: 8350

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.

Upvotes: 0

Views: 55

Answers (1)

user2033671
user2033671

Reputation:

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]-->

Upvotes: 1

Related Questions