恐怕这可能是不可能的,但有没有办法改变一个URL的哈希值不留在浏览器的历史记录中的条目并没有重装?或者做同等的?
至于具体细节,我正在开发一些基本的哈希导航:
//hash nav -- works with js-tabs
var getHash = window.location.hash;
var hashPref = "tab-";
function useHash(newHash) {
//set js-tab according to hash
newHash = newHash.replace('#'+hashPref, '');
$("#tabs li a[href='"+ newHash +"']").click();
}
function setHash(newHash) {
//set hash according to js-tab
window.location.hash = hashPref + newHash;
//THIS IS WHERE I would like to REPLACE the location.hash
//without a history entry
}
// ... a lot of irrelavent tabs js and then....
//make tabs …Run Code Online (Sandbox Code Playgroud) javascript jquery browser-history fragment-identifier browser-state