zoukankan      html  css  js  c++  java
  • 5. window.location.href/replace/reload()--页面跳转+替换+刷新

    1、window.location=url;

    window.location 对象用于获得当前页面的地址 (URL),并把浏览器重定向到新的页面。

    一、最外层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():强制刷新页面,从服务器重新请求!

     //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

    <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);

    </script>

     

  • 相关阅读:
    Dig out deleted chat messages of App Skype
    Search history in "Maps"
    如何对具有端点加密功能的LINE进行取证
    HttpHandler实现网页图片防盗链
    自定义文本验证控件
    MySQL查询本周、上周、本月、上个月份数据的sql代码
    org.hibernate.NonUniqueObjectException
    Struts2 中的值栈的理解
    struts2中struts.xml配置文件详解
    基于Struts自定义MVC-2
  • 原文地址:https://www.cnblogs.com/zkx4213/p/4893105.html
Copyright © 2011-2022 走看看