问题
I want to redirect a IE7 user, but window.location.href
does not seen to work properly.
Any suggestion?
$('.navigation-next a').bind('click', function (a) {
a.preventDefault();
window.location.href = $(this).attr('href')
})
Worked with:
$('.navigation-next a').bind('click', function(a) {
location.href = $(this).attr('href')
})
Thanks!
回答1:
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]-->
This is why all web developers should drop support for IE until Microsoft fixes it!
来源:https://stackoverflow.com/questions/9180276/ie7-window-location-href