更新时间:2022-11-04 13:00:24
他们使用 history API,或具体来说,history.pushState()
.
你可以使用这个,jQuery不是必须的,但是有插件比如history.js.>
这适用于大多数浏览器,即 Chrome、Safari 和 Firefox.IE10 及以上支持这一点.在较旧的 IE 中,您可以重新使用散列 (window.location.hash
).
Go to any GitHub page and click on any of the directories/files and observe how the URL changes but only part of the page is updated. There's no whole page reloading.
How do I do something similar using jQuery?
Does this work on most browsers (I'm using Chrome)?
They use the history API, or specifically, history.pushState()
.
You can use this, jQuery is not required, but there are plugins such as history.js.
This works on most browsers, namely Chrome, Safari and Firefox. IE10 and above supports this. In older IEs, you can fall back onto using the hash (window.location.hash
).