`

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。

 

 

 

分享到:
评论
6 楼 wolf746773350 2015-09-18  
5 楼 wolf746773350 2015-09-18  
[/flash]
4 楼 wolf746773350 2015-09-18  
dddd
3 楼 wolf746773350 2015-09-18  
[list]
[*]

[/list]
2 楼 wolf746773350 2015-09-18  
                              
1 楼 wolf746773350 2015-09-18  
           

相关推荐

    jsp 刷新父页面

    刷新本页Response.Write("&lt;script&gt;window.location.href=window.location.href; &lt;/script&gt;"); 刷新父页和本页面: Response.Write("&lt;script&gt;alert('提交成功!');window.location.href=window.location.href;window....

    nginx安装教程

    sudo ./nginx -s reload root实例: location ^~ /t/ { root /www/root/html/; } 如果一个请求的URI是/t/a.html时,web服务器将会返回服务器上的/www/root/html/t/a.html的文件。 alias实例: location ^~ /t/ {...

    JS窗口大全----很全的哦

    //-----------按钮提示框----------// ...window.opener.location.reload();window.close()"&gt;返回&lt;/a&gt; javaScript:window.location.reload();//返回当前页并刷新 。。。。。。。。。。。。。。。。。。。。

    js 页面刷新location.reload和location.replace的区别小结.docx

    js 页面刷新location.reload和location.replace的区别小结.docx

    tomcat-7.0.52.tar.gz 【linux】

    ./startup.sh 8.修改防火墙的规则: 方式1:service iptables stop 方式2:放行8080 端口 修改配置文件 cd /etc/sysconfig vi iptables 复制(yy p) -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 ...

    sciter-sdk-4.0.0.7

    [script, regex] fix of hangup on "test".replace(/\u0000/g, ""); [osx] compiler settings to reduce binary sizes. [css, layout] flow:horizontal; vertical-align fix. [win] fix of WM_SETTINGCHANGE ...

    Redhat 使用CentOS的yum源进行升级或软件安装

    Redhat默认的源不但速度不给力,而且软件版本陈旧,今天试着将Redhat默认源替换为CentOS的163源,发现速度能达到2M/s左右,而且版本都比较新,非常给力,与大家分享! (目前可以使用CentOS0-6.3软件仓库的软件) ...

    vue-hot-reload-api:HotVue组件的热重载API

    vue-hot-reload-api 注意: vue-hot-reload-api@2.x仅适用于vue@2.x Vue组件的热重装API。 这就是和在引擎盖下使用的东西。用法仅当您基于Vue组件编写一些构建工具链时,才使用此功能。 对于正常的应用程序使用,只...

    开机自起nginx

    [root@web1 ~]# cat /lib/systemd/system/nginx.service [Unit] Description=nginx After=network.target  ...#ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecReload=/usr/bin/kill -s HUP $MAINPID

    C8051F410定时器程序

    #define TIMER0_RELOAD_HIGH AUX4 // Reload value for Timer0 high byte #define TIMER0_RELOAD_LOW AUX3 // Reload value for Timer0 low byte sbit LED = P2^1; // LED='1' means ON //-----------------------...

    SRS 2.0-258 windows版本

    /usr/lib/gcc/i686-pc-cygwin/7.4.0/../../../../i686-pc-cygwin/bin/ld: objs/src/ap p/srs_app_st.o: in function `Z11srs_st_initv': /mnt/srs-2.0-r5/trunk/src/app/srs_app_st.cpp:217: undefined reference to...

    Openssh-8.3p1编译安装包.tar.zip

    ./configure --prefix=/usr/ --sysconfdir=/etc/ssh/ --with-ssl-dir=/usr/local/ssl --with-md5-passwords --mandir=/usr/share/man/ make && make install echo "PermitRootLogin yes" &gt;&gt; /etc/ssh/sshd_config ...

    spring3.2+strut2+hibernate4

    &lt;constant name="struts.counfiguraction.xml.reload" value="true"/&gt; &lt;!-- 指定浏览器输出的编码格式 --&gt; &lt;constant name="struts.il8n.encoding" value="utf-8"/&gt; &lt;!--将action内容放在package元素下,...

    nginx安装与使用.zip

    nginx安装与使用 ... Nginx开发从入门到精通 ... nginx官网上下载相应的安装包,--- 直接解压就行了 ... 相应的命令: nginx.exe -s stop //停止nginx nginx.exe -s reload //重新加载nginx nginx.exe -s quit //退出nginx

    CentOS7.2.1511 gcc4.8.5 通过编译的 tfs2.2.16

    [root@2f60c4bcddfa tfs_release-2.2.16]# ./configure --prefix=/usr/local/ configure ok make 问题 : serialization.h:575:27: error: conversion to 'char' from 'long int' may alter its value [-Werror=...

    [removed].reload 刷新使用分析(去对话框)

    使用[removed].reload;...window.opener.location.href=window.opener.location.href; window.opener.location.reload(); 这种写法就不出现那讨厌的对话框啦! 介绍JS实现刷新iframe的方法 &lt;iframe src=”1.ht

    JS刷新父页面 父窗口

    // 刷新父页面。此段代码放在被弹出的页面 function refreshOpener() { var win = top.window; try { if (win.opener) win.opener.location.reload();//或parent.location.reload(); } catch (ex) { } } .......

    UE(官方下载)

    UltraEdit includes a Search and Replace Favorites feature that allows you to manage frequently used Find and Replace strings. Create, name, and edit your Search and Replace Favorites... Customizing ...

    Ubuntu_Hadoop部署笔记

    CLASSPATH=./:/usr/lib/jvm/java-6-openjdk/lib JAVA_HOME=/usr/lib/jvm/java-6-openjdk PATH添加::/usr/lib/jvm/java-6-openjdk 二、新增hadoop用户 命令:sudo addgroup hadoop1001 sudo adduser --ingroup ...

    Creator口红机实现lipstick_3.zip

    js.reload(DataMgr.leftLipstick, DataMgr.levelInfo[DataMgr.currentLevel - 1].totalLipstick); if(DataMgr.leftLipstick ){ this.nodeLipstick.active = false; } else{ this.nodeLipstick....

Global site tag (gtag.js) - Google Analytics