javascript | 刷新页面的方式

95 阅读1分钟

方式

序号方法
1history.go()
2location.reload()
3location = location
4location.assign(location.href)
5location.replace(location.href)
6location.replace(document.referrer)
7window.location.href = document.URL
8window.location.href = document.location.href
9window.open(document.referrer, "_parent", "")
10document.location.href = window.location.href
11document.location.href = document.URL
12document.execCommand("Refresh") (已废弃)
13window.navigate(url)(只针对IE浏览器,避免使用,不兼容)

参考文档

1、developer.mozilla.org/zh-CN/docs/…

2、blog.csdn.net/m0_46652188…

3、blog.csdn.net/hu101003719…

其他

image.png