IE7 window.location.href [英] IE7 window.location.href

查看:109
本文介绍了IE7 window.location.href的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想重定向IE7用户,但是window.location.href不能正常工作.

I want to redirect a IE7 user, but window.location.href does not seen to work properly.

有什么建议吗?

$('.navigation-next a').bind('click', function (a) {
    a.preventDefault();
    window.location.href = $(this).attr('href')
})

使用过:

$('.navigation-next a').bind('click', function(a) {
   location.href = $(this).attr('href')
})

谢谢!

推荐答案

您必须在IE7和更早版本上使用window.location.replace().

You have to use window.location.replace() on IE7 and earlier.

<script type="text/javascript">
    function redir(url){ window.location=url; }
</script>

<!--[if lte IE 7]>
<script type="text/javascript">
    function redir(url){ window.location.replace(url); }
</script>
<![endif]-->

这就是为什么所有Web开发人员都应放弃对IE的支持,直到Microsoft对其进行修复!

这篇关于IE7 window.location.href的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆