I'm trying to change the SRC
attribute of my iFrame for users on IE 8 or less.
Here's my code :
<script>
var i_am_old_ie = false;
<!--[if lte IE 8]>
i_am_old_ie = true;
<![endif]-->
</script>
<script type="text/javascript">
$(document).ready(function() {
if(i_am_old_ie) {
$("#shop").attr("src","shopping_cart/browser_support.html");
} else {
$("#shop").attr("src","shopping_cart/index.html");
}
});
</script>
It detects that it's IE...but still sends all IE users to shopping_cart/browser_support.html
. Even if I use IE 9, it will send me there. Same thing for 7, or 8.
But it sends all other users not using IE to shopping_cart/index.html
(wich is correct).
What's wrong in my code?
Thank you!