Javascript 我在history.js上做错了吗?
当用户浏览页面和链接时,我的web应用程序使用ajax进行部分页面更新Javascript 我在history.js上做错了吗?,javascript,ajax,back,history.js,Javascript,Ajax,Back,History.js,当用户浏览页面和链接时,我的web应用程序使用ajax进行部分页面更新 ... http://localhost:8080/webapp/#2 http://localhost:8080/webapp/#3 http://localhost:8080/webapp/#4 http://localhost:8080/webapp/#5 ... 当用户从ajax页面转到非ajax页面时,如 http://localhost:8080/webapp/#4 到 http://localhost:808
...
http://localhost:8080/webapp/#2
http://localhost:8080/webapp/#3
http://localhost:8080/webapp/#4
http://localhost:8080/webapp/#5
...
当用户从ajax页面转到非ajax页面时,如
http://localhost:8080/webapp/#4
到
http://localhost:8080/webapp/help.html
然后,需要让用户能够通过浏览器返回按钮返回到上一页,以便使其正常工作。我在控制哈希更改的函数中使用history.js
$( function() {
var History = window.History;
console.log( "************" + History.enabled );
$(window).on('hashchange', refreshByHash);
});
问题是,当用户从页面help.html
中单击browser back按钮时,首先会出现webapp/#1
页面,然后出现webapp/#4
页面,看起来浏览器中出现了不必要的闪烁
那么我对history.js做了什么错事,以及如何正确使用它来避免那些不必要的闪烁呢