1
所以我看到很多人推荐的hidden- iFrame
黑客是jQuery history plugin但我真正需要的是这种技术的另一半:如何添加浏览器历史记录状态?
function whenItemIsClicked()
{
window.location.hash = this.id;
//some other stuff, like Ajax
}
//and then, if page is reloaded...
$(document).ready(function(){
var loc = window.location.hash;
//if there happens to be a hash, navigate to corresponding content
if(loc != '') $(loc).click();
});
这两项工作的伟大。现在,我想附加这两行
var loc = window.location.hash;
if(loc != '') $(loc).click();
给一个事件,但似乎没有一个将会一直被后退按钮触发。有没有办法添加一个浏览器历史状态,将保存当前的URL,以便上述技术将工作?