Html5 新增history对象的两个方法:history.pushState()和history.replaceState(),方法执行后,浏览器地址栏会变成你传的url,而页面并不会重新载入或跳转。history.pushState(state,title,url):通过设置state、title和url创建新的浏览器历史记录。
例如:
var state = { \'page_id\': 1, \'user_id\': 5 };
var title = \'Hello World\';
var url = \'hello-world.html\';
history.pushState(state, title, url);
history.replaceState(state,title,url):通过设置state、title和url修改当前浏览器历史记录。
注意:为了安全性,URL必须保持与当前URL同一个域。