没有Hash标签的Github如何做pushState?
我一直在研究利用 HTML5 的历史 api 又名 psuhState 的最佳方法,并为 HTML4 浏览器提供适当的后备。
Github 使用历史 API 进行树浏览(以下链接只是一个示例,不是 github 使用的库):
https://github.com/browserstate/History.js/
我不明白的是他们如何处理 HTML4 浏览器(例如 Firefox 3.5)的此功能?
我特别研究了history.js(上面链接)来处理这类事情。但它需要 HTML4 浏览器的 hash # 实现,我想避免这种情况。
如果您访问 Github 并使用 HTML4 浏览器浏览目录树,它看起来与 HTML5 浏览器相同(即 url 状态)。
如果我在 FF3.5 中禁用 JavaScript,则以前的 URL 如下所示:
https ://github.com/browserstate/history.js/tree/master/tests
现在看起来像这样:
https://github.com/browserstate/history.js/tree/a32e91aa1fe5909a29abb690a37f6c129e98068e/tests
有什么想法吗?
I've been researching the best way to utilize HTML5's history api aka psuhState with a proper fallback for HTML4 browsers.
Github uses the history api for its tree browsing (the following link is just an example, not the library github uses):
https://github.com/browserstate/History.js/
What I can't figure out is how they handle this functionality for HTML4 browsers such as Firefox 3.5?
I've looked at, specifically, history.js (linked above) to handle this sort of thing. But it requires a hash # implementation for HTML4 browsers which I'd like to avoid.
If you visit Github and browse a directory tree using an HTML4 browser, it looks identical to an HTML5 browser (the url state, that is).
If I disable JavaScript in FF3.5, a URL which previously looked like this:
https://github.com/browserstate/history.js/tree/master/tests
now looks like this:
https://github.com/browserstate/history.js/tree/a32e91aa1fe5909a29abb690a37f6c129e98068e/tests
Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
GitHub 使用 http://pjax.heroku.com/
对于不支持 pushState 的浏览器,它只会降级为正常的旧无聊全页加载行为。
GitHub uses http://pjax.heroku.com/
For browsers that don't support pushState it simply degrades to normal old boring full-page-load behaviour.
未来的响应式网页设计是来自 GitHub 设计师 Kyle Neath 的 96 张幻灯片演示,这可能对你有帮助。
Responsive web design from the future is a 96 slide presentation from Kyle Neath, a designer that works at GitHub, that might help you.