location.assign()、location.href、location.replace(url)的不同

简介:   window.location.assign(url) : 加载 URL 指定的新的 HTML 文档。 就相当于一个链接,跳转到指定的url,当前页面会转为新页面内容,可以点击后退返回上一个页面。

 

 

window.location.assign(url) : 加载 URL 指定的新的 HTML 文档。 就相当于一个链接,跳转到指定的url,当前页面会转为新页面内容,可以点击后退返回上一个页面。

window.location.replace(url) : 通过加载 URL 指定的文档来替换当前文档 ,这个方法是替换当前窗口页面,前后两个页面共用一个
窗口,所以是没有后退返回上一页的
目录
相关文章
|
4月前
Angular获取Location对象,获取当前网页url、hash、hostname、href、pathname、port、protocal
Angular获取Location对象,获取当前网页url、hash、hostname、href、pathname、port、protocal
|
5月前
location
location
30 0
|
7月前
|
缓存 JavaScript
|
JavaScript Java
window.location.href跳转问题2
"window.location.href"、"location.href"是本页面跳转 "parent.location.href"是上一层页面跳转 "top.location.href"是最外层的页面跳转 举例说明: 如果A,B,C,D都是jsp,D是C的iframe,C是B的iframe,B是A的iframe,如果D中js这样写 "window.
973 0
How is navigation target url request handled by backend
How is navigation target url request handled by backend
156 0
How is navigation target url request handled by backend
GM6 PageSet request didn't have target application url
GM6 PageSet request didn't have target application url
130 0
GM6 PageSet request didn't have target application url
为什么 window.location.search 为空?
1,什么是window.location?示例 URL:http://b.a.com:88/index.php?name=kang&when=2011#first 属性 含义 值 protocol: 协议 "http:" hostname: 服务器的名字 "b.
1757 0

热门文章

最新文章