window.pushState 不会增加历史记录长度

ps0*_*604 5 javascript html5-history

我有以下尝试操作堆栈的代码window.history

  console.log("before:" + window.history.length);
  window.history.pushState(null, null, '/page1');
  console.log("after:" + window.history.length);
Run Code Online (Sandbox Code Playgroud)

尽管我添加了一个状态,但在beforeand中总是打印相同的内容:after

before:50
after:50
Run Code Online (Sandbox Code Playgroud)

为什么pushState不增加历史长度?顺便说一句,50即使我刷新页面,长度也总是如此。