Javascript 这段代码是什么意思(history.replaceState和history.pushstate)

Javascript 这段代码是什么意思(history.replaceState和history.pushstate),javascript,Javascript,我创建了它,但我无法理解它 history.replaceState( null, document.title, location.pathname + "#!/redirect" ); history.pushState( null, document.title, location.pathname ); window.addEventListener( "popstate", function() { if( location.hash === "#

我创建了它,但我无法理解它

 history.replaceState( null, document.title, location.pathname + "#!/redirect" );
     history.pushState( null, document.title, location.pathname );
     window.addEventListener( "popstate", function() {
        if( location.hash === "#!/redirect" ) {
            setTimeout( function() {
                location.replace( "<<link>>" );
            }, 0 );
        }
    }, false);
history.replaceState(null,document.title,location.pathname+“#!/redirect”);
history.pushState(null,document.title,location.pathname);
addEventListener(“popstate”,function()){
if(location.hash==“#!/redirect”){
setTimeout(函数(){
位置。替换(“”);
}, 0 );
}
},假);
提前感谢历史。pushState() 使用指定的标题和URL(如果提供)将给定数据推送到会话历史堆栈上。DOM将数据视为不透明数据;您可以指定任何可以序列化的JavaScript对象

History.replaceState() 更新历史堆栈上的最新条目,使其具有指定的数据、标题和URL(如果提供)。DOM将数据视为不透明数据;您可以指定任何可以序列化的JavaScript对象

更多信息 或