Github如何推送无散列标签的状态? [英] How Does Github Do pushState Without Hash Tags?

查看:116
本文介绍了Github如何推送无散列标签的状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



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/测试



有什么想法?

解决方案

GitHub使用 http://pjax.heroku.com/



对于br不支持pushState的owl只会降低到正常的旧无聊整页加载行为。


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?

解决方案

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如何推送无散列标签的状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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