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

其他

image.png


__EOF__

本文作者杨芋可可
本文链接https://www.cnblogs.com/yangyukeke/p/17201431.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐一下。您的鼓励是博主的最大动力!
posted @   杨芋可可  阅读(24)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示