我想重定向一个 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/