javascript - Facebook 中 URL 发生变化的网页部分更新效果

标签 javascript html ajax page-refresh

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/

相关文章:

javascript - 如何获取比数组中其他元素更大的3个对象javascript

javascript - jquery/js 中特定字符后添加换行符

Javascript 片段不起作用(缺少库?)

html - 如何对齐 mat-action-row 按钮?

javascript - 谁知道我的ajax出了什么问题?

javascript - 无法提交表单 - ReactJs

javascript - ng-disabled 无法正常工作 5

javascript - 在同一页面上的不同时间刷新多个 div

javascript - JSON 对象 -> 数组?我应该如何转换它?

java - 解析 FileList 对象中的文件