在 Firefox Quantum 中刷新页面后丢失 window.history.state

Lose window.history.state after page refresh in Firefox Quantum

不知道是历史库问题还是浏览器问题,但是...

我正在使用 Firefox Quantum 57.0.4 64 位,当我 select url 并按回车键时,更新页面后我无法获得 history.location.state。调查后发现window.history.state为空

有人遇到过这个错误吗?

我不确定这是否是 Firefox 中的错误,因为在其他浏览器(即 Chrome/IE11/Edge)中使用 window.history.replaceState(null, null, url); 可以正常工作。 FF 的修复似乎正在使用 window.history.pushState(null, null, url);,如此处所述 https://developer.mozilla.org/en-US/docs/Web/API/History_API 使用pushState时按F5就可以了

编辑:是一个 firefox 错误,尚未修复:https://bugzilla.mozilla.org/show_bug.cgi?id=1422334

Edit2:我们目前在 FF 中使用 pushState 而不是 replaceState(仅在 FF 中),直到提到的错误被修复。