window.location.href
时间: 2023-08-30 10:08:21 浏览: 179
window.location.href页面跳转的用法(区别于redirect)
4星 · 用户满意度95%
window.location.href是用于获取或设置当前页面的 URL 地址。它可以用来打开一个新的页面或刷新当前页面。关于window.location.href的用法,主要有以下几种:使用self.location.href或window.location.href或this.location.href或location.href或parent.location.href可以在当前页面打开一个新的URL页面,或者使用top.location.href可以在顶层页面打开一个新的页面。另外,使用window.open()方法也可以打开一个新的窗口。而window.location.href=window.location.href和window.location.Reload()都可以刷新当前页面,区别在于是否有提交数据。当有提交数据时,window.location.Reload()会提示是否提交,而window.location.href=window.location.href则是向指定的URL提交数据。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [JavaScript中window.open()和Window Location href的区别](https://blog.csdn.net/qq_41694906/article/details/88224861)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [window.location.href](https://blog.csdn.net/zhangweigangweiwu/article/details/52288815)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [undefined](undefined)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文