JS Refresh page and jump

Source: Internet
Author: User

JavaScript returns to the previous page:

1, return to the previous page history.go (-1); Returns up to two pages History.go (-2);

<a href= "Javascript:history.go (-1);" > Prev </a>

2, History.back ().

3, Window.history.forward () return to next page

4, Window.history.go (return to the first page, can also be a URL)

5, Window.location.href=url;

JS Refresh the page in several ways:

1, history.go (0);

2, window.location.href= the current page URL;

3, Location=location;

4, Location.replace (location);

5, Location.assign (location);

6, Window.navigate (location);

7, document. Url=location.href

Ways to automatically refresh pages:

1. Automatic page refresh: Add to

<meta http=-equiv= "Refresh" content= ">" 20 means refresh every 20s

2. Automatic page Jump: Add in

<meta http=-equiv= "Refresh" content= "20;url=" http:www.baidu.com "> 20 means 20s after jump to http://www.baidu.com

3, the page automatically refresh, JS

<script language= "JavaScript" >    function  myrefresh ()    {           window.location.reload ();    }    SetTimeout (// specify 1 seconds to refresh once </script>

JS Refresh page and jump

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.