Possible Duplicate:
Modify the URL without reloading the page
我发现在 Facebook 中,如果我点击左侧部分的注释或音乐链接,当 URL 更改时,只有中间部分会刷新,来自 www.facebook .com 至 www.facebook.com/注释。
据我所知,更改 URL 会触发整个页面重新加载。 Facebook 对其网页有何魔力?
最佳答案
神奇的是history.pushState() .
Example
Suppose http://mozilla.org/foo.html executes the following JavaScript:
var stateObj = { foo: "bar" };
history.pushState(stateObj, "page 2", "bar.html");
This will cause the URL bar to display http://mozilla.org/bar.html, but won't cause the >browser to load bar.html or even check that bar.html exists.
关于javascript - Facebook 中 URL 发生变化的网页部分更新效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14054434/