history.replaceState 替换以后执行location.reload仍然产生历史

直接上代码说明吧

刷新前

console.log(history.length);  // 输出:1

history.replaceState(null,null,'?a=1'); // 现有参数为 ?b=1

location.reload();

刷新以后

console.log(history.length); // 输出:2

测试环境: android8.0.0 WKWebview 内核是chrome

ios环境下面没有问题,想知道这是android有单独的处理或者约定吗? 求大神指导

阅读 3.1k
1 个回答

应该是你的代码不准确,没能复现这个问题

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题