history
对浏览器历史记录的操作:
state (状态对象):记录历史记录点的额外对象,可以为空
title (页面标题):目前所有浏览器都不支持
url (可选的url):浏览器不会检查url是否存在,只改变url,url必须同域,不能跨域
1、history.pushState
history.pushState( state , title , url)
将指定的 URL 添加到浏览器历史里
2、history.replaceState
history.replaceState( state , title , url)
用指定的 URL 替换当前页面的 URL
注:以上操作都只是对历史记录的更改,但不引起浏览器页面的更新。
当然,还有 history.go(),history.back(),history.forward()。这些操作都是会引起浏览器页面的更新的。
| 浏览器 | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
| 版本 | 5 | 12 | 4.0(2.0) | 10 | 11.50 | 5.0 |

浙公网安备 33010602011771号