Window.location.href IE a solution to jump failure
- 2020-03-30 02:29:57
- OfStack
<a href="javascript:void(0)" >GoNext</a>
$("a").click(function(){
window.location.href = "xxx.html";
})
As shown in the code above, under IE, especially in IE6, the browser does not jump after the hyperlink is clicked.
The reason may be that javascript:void(0) in href prevents the event behavior. The solution is as follows:
1. Add return false to the onclick event to prevent bubbling:
$("a").click(function(){
window.location.href = "xxx.html";
reutrn false;
})
Delay by 100 milliseconds
$("a").click(function(){
setTimeout(function(){
window.location.href = "xxx.html";
},100);
})