Home  >  Article  >  Web Front-end  >  浏览 GitHub 项目的目录结构时,点击一个目录或文件链接是如何做到局部刷新,URL 同时被更新,这是什么原理?

浏览 GitHub 项目的目录结构时,点击一个目录或文件链接是如何做到局部刷新,URL 同时被更新,这是什么原理?

WBOY
WBOYOriginal
2016-06-07 08:43:071932browse

如: github.com/rails/rails/
但是IE上没有这种效果,是整页刷新的。

回复内容:

通过调用 history.pushState 方法。
详见: developer.mozilla.org/e IE 和 firefox4 以下是不支持history.pushState的, 应该有代码判断是否支持此funtion然后相应会整页刷新。你可以用history.js,兼容低版本浏览器 : github.com/balupton/His
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn