javascript - IE7 window.location.href

标签 javascript internet-explorer-7

我想重定向一个 IE7 用户,但是 window.location.href 没有正常工作。

有什么建议吗?

$('.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()

<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 修复它!

关于javascript - IE7 window.location.href,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9180276/

相关文章:

javascript - 如何在 JS 中判断某个函数/方法是否存在于 IE7 中?

javascript - 使用javascript根据给定年龄计算出生日期

javascript - 在 JQuery 文件中获取 WordPress 帖子 ID

javascript - 如何计算Javascript中日期对象数组中任意时间的时间百分比

css - IE7 : background-img on multipleline text

jquery - 下拉菜单在 IE7 中消失

javascript - Javascript 可以用另一种语言代替吗?

javascript - 在重新加载页面后,在 Angular js 中,使用 $locationProvider.html5Mode(true); 后,服务器上出现错误 404 找不到页面;

jquery - IE7 的 Galleriffic 插件问题

css - 适用于 IE7 的 IE7 CSS