页面刷新、重定向的方法

http://www.jianshu.com/p/b4e4f13cd231?utm_campaign=haruki&utm_content=note&utm_medium=reader_share&utm_source=weixin

一、使用meta

1.页面刷新<meta http-equiv="refresh" content="5">
2.页面跳转<meta http-equiv="refresh" content="5; url=http://www.jianshu.com"/>

二、使用js

  1. js页面刷新方法

    history.go(0) 
    location.reload()
    location=location 
    location.assign(location) 
    document.execCommand('Refresh') 
    window.navigate(location) 
    location.replace(location) 
    document.URL=location.href
  2. js跳转

    window.location.href="target.aspx"; 
    window.navigate("target.aspx");
    window.location.replace("target.aspx");
    self.location='target.aspx';
    top.location='target.aspx';

 

posted @ 2016-10-16 16:10  chenxj  阅读(202)  评论(0)    收藏  举报