jquery plugin history not working on IE8
I am using the the jquery history plugin from http://www.mikage.to/jquery/jquery_history.html.
I am not able to get the plugin to work on IE8. In Firefox it works as expected. IE8 works on the sample at the site of the plugin-creator.
My site contains 3 links. I click entry 1 through 3 first. When entry 3 is shown I hit the back button and get to the url http://localhost:5000/de/Playground/HistoryTest#link2. The correct entry is displayed.
The forward button of the browser is not shown, but it should be shown.
Then I hit the back button again, but I dont get to entry 1: instead I get to entry 3.
Anybody knows if I am doing something wrong?
Here is the script. I use
<script type="text/javascript" >
function callbackHistory(hash) {
if (hash != '') {
if ($.browser.msie) {
// jquery's $.load() function does't work when hash include special characters like aao.
hash = encodeURIComponent(hash);
}
//alert(hash);
$.ajax({
type: "GET",
url: "/de/Playground/HistoryDetail",
data: {
DataKey: hash
},
success: function(htmlSource) {
$("#ajaxContainer").html(htmlSource);
}
});
}
}
$(document).ready(function() {
$.history.init(callbackHistory);
$("a").click(function开发者_运维知识库() {
$.history.load(this.href.replace(/^.*#/, ''));
return false;
});
});
</script>
HMTL
<a href="#link1" rel="history" >link1 </a>
<a href="#link2" rel="history" >link2 </a>
<a href="#link3" rel="history" >link3 </a>
<div id="ajaxContainer" >
</div>
The Server Part only renders an HTML snippet that inlcudes the hash.
<h3>
<%= hash >
</h3>
It turned out that I used an old version of the plugin.
The header of the plugin I used sais:
2006 Taku Sano
but the recent file has
2006-2009 Taku Sano
I used the sample from the "Jquery Cookbook". That sample used the old plugin. The sample on the page of the plugin author uses the recent version and works in IE.
精彩评论