【问题标题】:jquery plugin history not working on IE8jquery 插件历史在 IE8 上不起作用
【发布时间】:2010-04-06 16:13:49
【问题描述】:

我正在使用来自http://www.mikage.to/jquery/jquery_history.html 的 jquery 历史插件。

我无法让插件在 IE8 上运行。在 Firefox 中,它按预期工作。 IE8 在插件创建者的站点上处理示例。

我的网站包含 3 个链接。我首先单击条目 1 到 3。当显示条目 3 时,我点击返回按钮并访问 url http://localhost:5000/de/Playground/HistoryTest#link2。将显示正确的条目。

浏览器的前进按钮不显示,但应该显示。

然后我再次点击后退按钮,但我没有进入条目 1:而是进入条目 3。

有人知道我做错了什么吗?

这是脚本。我用

<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>

服务器部分仅呈现包含哈希的 HTML sn-p。

<h3>
<%= hash >
</h3>

【问题讨论】:

    标签: jquery asp.net-mvc jquery-plugins


    【解决方案1】:

    原来我用的是旧版本的插件。

    我使用的插件的头部是sais:

    2006 佐野拓

    但最近的文件有

    2006-2009 佐野拓

    我使用了“Jquery Cookbook”中的示例。该示例使用了旧插件。插件作者页面上的样例使用的是最新版本,在IE下运行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-11-27
      • 2012-01-25
      • 2011-07-09
      • 2011-03-07
      • 1970-01-01
      • 1970-01-01
      • 2020-01-06
      • 1970-01-01
      相关资源
      最近更新 更多