1

好吧,我试图让 html5 历史 API 正常工作(无需重新加载页面)

但我找不到我在路径中间出错的地方。

www2.madeinweb.com.br/inovacao/transitions/

这是我的演示页面。

$(function() {
    $(".external").click(function() {
        var href = $(this).attr('href');
        $(body).load(href);
        history.pushState( null, null, href );
        return false
    });

    $( window ).bind( "popstate", function( e ) {
        var returnLocation = history.location || document.location;
        alert( returnLocation.href );
    });
}); 

这是我现在正在使用的脚本。我不确定我现在使用的加载方法。这是最好的解决方法吗?

谢谢。

4

0 回答 0