cssmagic / history.state Goto Github PK
View Code? Open in Web Editor NEWPolyfill `history.state` on iOS 5- and Android 4.3-.
Polyfill `history.state` on iOS 5- and Android 4.3-.
即 fulfills polyfill - updating
history.stateafter
popstate event
这个测试用例需要测到:
historyState.isSupported()
判断当前环境是否支持通过 history.state
属性获取当前 state。
这是一个非常重要的方法,如果你的业务需要使用 history.state
特性,务必先使用此方法探测其是否可用。
(无)
布尔值。
// 在 iOS 5.x 或 Android 4.0~4.3 下运行:
historyState.isSupported() // => false
historyState.polyfill()
historyState.isSupported() // => true
historyState.polyfill()
初始化方法。
(注:从 2.0 版开始,此方法会自动执行,无需手动调用。)
老外也是需要她的呀。
要实现以下需求:
现在使用的方法是在沙盒中调用上层框架中预定义的回调方法,耦合较紧。
(感谢 @hax 提出此建议。)
具体怎么实现我还不知道,欢迎 PR。
加载后立即执行 .polyfill()
方法,无需手动调用此方法,使用更方便。
(感谢 @hax 提出此建议。)
在 Android 平台下,浏览器对 HTML5 特性的实现与否实际上取决于其使用的 WebKit 版本,而非 Android 版本。由于 Android 各版本原生内置 WebKit 引擎的版本是固定的,由 Android 系统版本来推测其内置浏览器的行为是可行的。
但 Andriod 系统下的第三方浏览器(比如 QQ 浏览器等)有可能自带内核,其 WebKit 版本可能超越系统。在这种情况下,现有测试是通不过的。
function _hasHistoryAPI() {
return 'onpopstate' in window &&
'replaceState' in history && typeof history.replaceState === 'function' &&
'replaceState' in history && typeof history.replaceState === 'function'
}
应该是检测pushState 和 'replaceState' 吧,代码里面2个'replaceState'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.