js刷新页面经常使用方法总结

最近在一个大杂烩里面,安插本身的一个项目,用dva 撸的一个发布管理系统,写的我是心力交瘁,焦头烂额~~~而后,接下来是今天的学习,其实也是本身平时没怎么注意到的问题 关于页面刷新经常使用的手法        history.go(0)        history.reload()        location = location        location.assgin(location)        document.execCommand('Refresh')        window.nvigate(location)        location.replace(location)        document.URL = location.href   自动刷新: php

<meta http-equiv="refresh" content="20">     
//  20 是指每隔 20秒刷新以面自动转跳页面
<meta http-equiv="refresh" content="20;url=http://www.xxx.net">    
 //  其 中20指隔20秒后跳转到http://www.xxx.net页面

 2. js 当前页面的刷新方法html

self.location.href  // 当前页面打开 URL页面
window.location.href // 当前页面打开URL页面
this.location.href // 当前页面打开URL页面
location.href // 当前页面打开URL页面
parent.location.href // 在父亲面打开新的链接
top.location.href //在顶层页面打开新页面

分析1:  若是自定义的是 frame 那么将parent、self、top 换成自定义frame 的名称,效 果实在frame 窗口打开url 链接 分析2: window.location.href = window.location.href 和 window.location.reload() 都是刷新当前页面。区别在因而否提交数据,当有提交数据的时候, window.location.reload() 会提示是否提交(面试常问题,若是你是一名PC段开发者) 分析3:   window.location.href 直接跳转到指定的url 分析4:window.location.open 确定被屏蔽掉。 分析5:top.location.href 是最外层的页面的转跳              window.location.href location.href 是本页面的跳转              parent.location.href 是上一层页面转跳 分析6:window.location.href 和 window.open的区别               window.open()是能够在一个网站上打开另外的一个网站的地址               window.location()是只能在一个网站中打开本网站的网页 延伸部分1: reload 方法,该方法强迫浏览器刷新当前页面 。 location.reload(bForceGet) 可选参数,默认是 false,从客户端缓存里面取当前页。当为true ,则是以get 方式,从服务器取最新的页面,至关于F5刷新。 replace 该方法经过指定URL替换当前缓存在历史里的项目,由于使用replace方法后,不能经过前进和后退 来访问已经被替换的URL 。 面试

延伸部分2: http-equiv 属性 --- HTTP 协议的响应报文 此属性出现的在meta 属性中,HTTP 协议的响应头报文 此属性的HTTP协议的响应头报文的值应使用content属性来描述 1.Content-Type Content-Language 显示字符集的设定     <meta http-equiv="Content-Type" Content="text/html; Charset=gb2312″ />     <meta http-equiv="Content-Language" Content="zh-CN" />  2.refresh 让页面多久刷新本身,或者在多长时间后网页本身转跳到其余页面。     <meta http-equiv="Refresh" Content="30″>     <meta http-equiv="Refresh" Content="5; Url=http://www.dalbll.com&quot; />   3.Expires(期限) 指定网页在缓存中的过时时间,一旦网页过时,必须到服务器上从新调阅     <meta http-equiv="Expires" Content="0″ />     <meta http-equiv="Expires" Content="Wed, 26 Feb 1997 08:21:57 GMT" /> 4.pragma 禁止浏览器从本地的缓存中调阅页面的内容     <meta http-equiv="Pragma" Content="No-cach" />   
转载于猿2048:➣《js刷新页面经常使用方法总结》浏览器

相关文章
相关标签/搜索