我正在尝试为IE 8或更低版本的用户更改我的iFrame的SRC
属性。对IE 8不起作用的条件注释
这里是我的代码:
<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>
它检测到它的IE浏览器...但还是将所有IE用户shopping_cart/browser_support.html
。即使我使用IE 9,它也会发送给我。同样的事情为7或8。
但它发送所有其他用户不使用IE到shopping_cart/index.html
(这是正确的)。
我的代码有什么问题?
谢谢!
完美,谢谢!现在正在工作。 – larin555 2012-08-01 21:06:01