阅读Webkit中的window.history.state对象 [英] Reading window.history.state object in Webkit

查看:133
本文介绍了阅读Webkit中的window.history.state对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Safari浏览器和Chrome浏览器(以及我猜测的所有Webkit浏览器)不会响应HTML5标准 window.history.state here 并在Firefox中实现。



是否有解决方法来读取它?也许有可能在代码中触发一个popstate事件并从事件处理程序返回状态?

解决方案

window.history.state 目前未在webkit broswers中实现。它有一个请求,但到目前为止尚未采取步骤实施。



有一个名为 history.js < a>,旨在提供交叉兼容的历史管理体验。
$ b


History.js优雅地支持HTML5历史/状态API(pushState, replaceState,onPopState)在所有浏览器中。包括对数据,标题,替换状态的持续支持。支持jQuery,MooTools和Prototype。对于HTML5浏览器,这意味着您可以直接修改URL,而无需再使用散列值。对于HTML4浏览器,它将恢复使用旧的onhashchange功能。


从该项目中, History.getState ()似乎做了请求。


Safari and Chrome (and, I'm guessing, all Webkit browsers) do not respond to window.history.state which is specified in the evolving HTML5 standard here and is implemented in Firefox.

Is there a workaround to read it? Perhaps it is possible to trigger a popstate event in code and return the state from the event handler?

解决方案

window.history.state is not implemented in webkit broswers currently. There is a request for it, but no steps towards implementation were done so far.

There is a project called history.js which is aiming to provide cross-compatible history management experience.

History.js gracefully supports the HTML5 History/State APIs (pushState, replaceState, onPopState) in all browsers. Including continued support for data, titles, replaceState. Supports jQuery, MooTools and Prototype. For HTML5 browsers this means that you can modify the URL directly, without needing to use hashes anymore. For HTML4 browsers it will revert back to using the old onhashchange functionality.

From that project, History.getState() seems to do what is requested.

这篇关于阅读Webkit中的window.history.state对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆