Javascript IE7 window.location.href
我想重定向IE7用户,但Javascript IE7 window.location.href,javascript,internet-explorer-7,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 =
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]-->
函数redir(url){window.location=url;}
这就是为什么所有web开发人员都应该放弃对IE的支持,直到微软修复它 它应该可以正常工作-发布你的代码你的意思是什么?AdamRackis更新了一个问题。只是在这里检查一下是否正常。但是您正在向锚元素添加单击事件处理程序,以转到该元素的href属性?默认情况下,它不需要JS。@JohnFx,因为它在启动“完成我的其他功能”时被禁用。如何在Javascript中检查它<代码>变量ie7=(document.all&&!window.opera&&window.XMLHttpRequest)代码>(返回真/假)?只需使用条件在HTML中包含额外的JS。这将大大减少麻烦,并且是针对每种浏览器的标准机制。虽然我对答案投了赞成票,但我猜反对票是由于web开发人员放弃IE支持的最后评论。首先,对于大多数公司的web开发人员来说,这是不可能的(相信我,如果可以的话,我会完全放弃IE)。其次,微软能够“修复”它的唯一方法是使用他们已经发布的新浏览器。不幸的是,与Chrome/Firefox/etc不同,在IE7所在的旧版本Windows中,更新既不是直观的,也不是自动的。从那以后,情况好多了!