[英]After history.back() , hisytory.pushState does not increment history length
Just like this picture就像这张照片一样
write something like below:写如下内容:
history.pushState(null,null,"./abc");
history.back();
console.log(history.length);
history.pushState(null,null,"./abc");
console.log(history.length);
I test it in chrome and firefox, both seems have this problem, I do not know why我用chrome和firefox测试了一下,好像都有这个问题,不知道为什么
I misunderstood the concept of history.length
我误解了
history.length
的概念
The History.length read-only property returns an integer representing the number of elements in the session history, including the currently loaded page. History.length 只读属性返回一个整数,表示会话历史记录中的元素数量,包括当前加载的页面。
https://developer.mozilla.org/en-US/docs/Web/API/History/length https://developer.mozilla.org/en-US/docs/Web/API/History/length
According to the concept , If you click back
button then go forward again.根据概念,如果单击
back
按钮,则再次前进。 the history.length would not change, because history.length is the number of elements in the session history. history.length 不会改变,因为 history.length 是会话历史中元素的数量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.