javascript | 刷新页面的方式
方式
| 序号 | 方法 |
|---|---|
| 1 | history.go() |
| 2 | location.reload() |
| 3 | location = location |
| 4 | location.assign(location.href) |
| 5 | location.replace(location.href) |
| 6 | location.replace(document.referrer) |
| 7 | window.location.href = document.URL |
| 8 | window.location.href = document.location.href |
| 9 | window.open(document.referrer, "_parent", "") |
| 10 | document.location.href = window.location.href |
| 11 | document.location.href = document.URL |
| 12 | document.execCommand("Refresh") (已废弃) |
| 13 | window.navigate(url)(只针对IE浏览器,避免使用,不兼容) |
参考文档
1、https://developer.mozilla.org/zh-CN/docs/Web/API/Document/execCommand
2、https://blog.csdn.net/m0_46652188/article/details/119867048
3、https://blog.csdn.net/hu1010037197/article/details/100427393

浙公网安备 33010602011771号