js refresh the page and jump

Back javascript:

1, Back history.go (-1); two return page history.go (-2);

<a href="javascript:history.go(-1);">上一页</a>

2、history.back().

3, window.history.forward () Return Next

4, window.history.go (return to the first few pages, it can be a url)

5、window.location.href=url;

js refresh the page several ways:

1、history.go(0);

2, window.location.href = current page url;

3、location=location;

4、location.replace(location);

5、location.assign(location);

6、window.navigate(location);

7、document.URL=location.href

Method of auto-refresh the page:

1, the automatic refresh page: Add the <head> tag

<Meta http = -equiv = "refresh" content = "20"> where 20 means refreshes every 20s

2, automatic page jump: Add the <head> tag

<Meta http = -equiv = "refresh" content = "20; url =" http: www.baidu.com "> 20 wherein the means to jump 20s http://www.baidu.com

3, pages automatically refresh, js

Copy the code
<script language="JavaScript">
    function myrefresh()
    {
           window.location.reload();
    }
    setTimeout('myrefresh()',1000); //指定1秒刷新一次
</script>

Guess you like

Origin www.cnblogs.com/hcm-php/p/11855786.html