仅适用于HTML5模式的History.js与window.History

仅适用于HTML5模式的History.js与window.History,html,browser-history,pushstate,history.js,html5-history,Html,Browser History,Pushstate,History.js,Html5 History,History.js与HTML5的window.History相比,现在有什么实质性的优势吗?我们对支持HTML4 hashbang URL不感兴趣 History.js,而window.History。我们需要此功能,因此如果没有大的理由使用History.js而不是原生的窗口。History仅在HTML5模式下,我们更愿意使用后者。是-在他们的网站上,他们说: 为所有HTML5浏览器提供交叉兼容体验(它们实现HTML5>History API的方式略有不同,会导致不同的行为,有时会出现bug

History.js与HTML5的
window.History
相比,现在有什么实质性的优势吗?我们对支持HTML4 hashbang URL不感兴趣


History.js,而
window.History
。我们需要此功能,因此如果没有大的理由使用History.js而不是原生的
窗口。History
仅在HTML5模式下,我们更愿意使用后者。

是-在他们的网站上,他们说:

为所有HTML5浏览器提供交叉兼容体验(它们实现HTML5>History API的方式略有不同,会导致不同的行为,有时会出现bug->History.js修复此问题,确保整个HTML5浏览器的体验如预期/相同/很棒)

这些差异很小,谷歌搜索还不足以找到它们——我必须查看源代码——看起来主要的差异是修复safari中的HTML5功能。 safari实现有两个问题-一个是history.back无法返回location.hash设置的哈希状态,该哈希状态通常被history.replaceState替换

第二个问题是,当safari繁忙时,它将无法应用状态更改

相关History.js源代码:

    History.bugs = {
        /**
         * Safari 5 and Safari iOS 4 fail to return to the correct state once a hash is replaced by a `replaceState` call
         * https://bugs.webkit.org/show_bug.cgi?id=56249
         */
        setHash: Boolean(!History.emulated.pushState && navigator.vendor === 'Apple Computer, Inc.' && /AppleWebKit\/5([0-2]|3[0-3])/.test(navigator.userAgent)),

        /**
         * Safari 5 and Safari iOS 4 sometimes fail to apply the state change under busy conditions
         * https://bugs.webkit.org/show_bug.cgi?id=42940
         */
        safariPoll: Boolean(!History.emulated.pushState && navigator.vendor === 'Apple Computer, Inc.' && /AppleWebKit\/5([0-2]|3[0-3])/.test(navigator.userAgent)),

因此,我想您的决定取决于您是否关心Safari 5和Safari IOS 4。

感谢您的有益研究。Safari bug不是我们的交易破坏者,所以我们坚持使用原生的
窗口。历史记录。但是,浏览器之间存在差异(最显著的是),因此我们必须围绕这些差异编写代码。