window.location.href/replace/reload()--页面跳转+替换+刷新

一、最外层top跳转页面,适合用于iframe框架集

top.window.location.href("${pageContext.request.contextPath}/Login_goBack");

============================================================================================

二、window.location.href和window.location.replace的区别

1.window.location.href=“url”:改变url地址;

2.window.location.replace(“url”):将地址替换成新url,该方法通过指定URL替换当前缓存在历史里(客户端)的项目,
因此当使用replace方法之后,你不能通过“前进”和“后 退”来访问已经被替换的URL,这个特点对于做一些过渡页面非常有用!

三、强制页面刷新

1.window.location.reload():强制刷新页面,从服务器重新请求!

============================================================================================

四、window.location.reload();页面实现跳转和刷新

1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL=location.href
这几个都可以刷新
window.location.reload();刷新
window.location.href=window.location.href;刷新
window.close();关闭窗口,不弹出系统提示,直接关闭 
window.close()相当于self属性是当前窗口
window.parent.close()是parent属性是当前窗口或框架的框架组
页面实现跳转的九种方法实例:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>navigate</title>
<script language="javascript">
    setTimeout('window.navigate("top.html");',2000);
    setTimeout('window.document.location.href="top.html";',2000);
    setTimeout('window.document.location="top.html";',2000);
    setTimeout('window.location.href="top.html";',2000);
    setTimeout('window.location="top.html";',2000);
    setTimeout('document.location.href="top.html";',2000);             
    setTimeout('document.location="top.html";',2000);
    setTimeout('location.href="top.html";',2000);
    setTimeout('location.replace("top.html")',2000);
    //window对象
        //document对象
            //location对象
                //href属性
                //1.window.document.location.href
                //2.window.document.location
                //3.window.location.href
                //4.window.location
              
                //5.document.location.href
                //6.document.location
                //7.location.href
                //8.window.navigate
                //9.location.replace
                //只要使用location方法,和任意的window对象,location对象,href属性连用,都可以页面的跳转////
</script>
</head>

<body>
页面将在2秒后跳转
</body>
</html>

解释:
location是个对象,比如本页的document.location和window.location的属性有   
  location.hostname   =   community.csdn.net
  location.href   =   http://community.csdn.net/Expert/topic/4033/4033372.xml?temp=2.695864E-02
  location.host   =   community.csdn.net
  location.hash   =  
  location.port   =  
  location.pathname   =   /Expert/topic/4033/4033372.xml
  location.search   =   ?temp=2.695864E-02
  location.protocol   =   http:
  可见href是location的属性,类别是string。

 

 

 

解决 location.href 引发的状态取消问题 在 Web 开发中,我们经常使用 location.href 来进行页面跳转。然而,有时候使用这种方式可能会引发状态取消的问题,导致页面无法正常加载。本文将介绍 location.href 引发的状态取消问题,并提供解决方法,确保页面跳转不会造成状态取消和其他异常情况。状态取消问题通常发生在使用 location.href 进行页面跳转时。当页面正在加载过程中,如果通过 location.href 进行跳转,可能会导致当前页面的加载被取消,而跳转目标页面也无法加载成功。 阅读详情

相关推荐

JS监听浏览器关闭、刷新及切换标签页触发事件

蛮简单的东西,知道就会,不知道就不会,没什么逻辑可言。简单记录一下,只为加深点儿印象。

专注于技术,分享实战经验,探索技术边界,用代码构建更美的数字世界。 1万+

window.location.replacewindow.location.href 的区别

昨天在处理一个具有返回功能的按钮时花了一些时间,就是返回到用户搜索的前一页,我用的是 window.location.go(-1),这就是正正经经的浏览器返回到前一条浏览记录的做法。可是有几个返回按钮却一直失灵,点击之后,可以看到浏览器刷新,但是还是停留在原来的页面。 仔细查看代码,终于发现了原因。就是用户从上一个页面 a 跳转到目前看到的这一个页面 c,其实中间还有一个页面 b,只是用户看不到,

Doggy的博客 4万+

window.location.hrefwindow.location.replace

说到这两个的使用区别,就得结合window.history.go(-1);wondow.history.back();这两个方法的机制了。 这两个方法是根据服务器记录的请求决定该跳到哪个页面。   window.location.href("test.jsp");是向服务器发送请求的跳转 window.location.replace("test.jsp");是不向服务器发送请求的跳转

oscar999的专栏 3438

window.location.href()/replace()/reload() -- 页面跳转+替换+刷新

window.location.href()/replace()/reload() -- 页面跳转+替换+刷新

m0_58293192的博客 1万+

window.location.href/replace/reload()--页面跳转+替换+刷新 区别

window.location.href/replace/reload()--页面跳转+替换+刷新 window.location跳转+替换+刷新  一、最外层top跳转页面,适合用于iframe框架集 top.window.location.href("${pageContext.request.contextPath}/Login_goBack"); =======

qq_16136211的博客 802
上一篇: ***我的Oracle SQL总结!!!
下一篇: Jquery AJAX|Jquery .serialize() --序列表表格内容为字符串,用于 Ajax 请求+序列化表单拼接Url字符串...
meng198672
博客等级 码龄18年 4粉丝 88原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值