JS back to the previous page and refresh the various implementation methods _javascript tips

Source: Internet
Author: User
<a href= "Javascript:history.go ( -1)" > Return to Previous page </a>
<a href= "Javascript:location.reload ()" > Refresh current page </a>
<a href= "javascript: onclick=" History.go (-2); "> Return to the first two pages </a>
<a href= "javascript:" onclick= "self.location=document.referrer;" > Go back to the previous page and refresh </a>
<a href= "javascript: onclick=" History.back (); "> Back to Previous page </a>

Page Jump:

onclick= "window.location.href= ' list.php '"

JavaScript refreshes the page in several ways:

1,history.go (0)
2,location.reload ()
4,location.assign (location)
5,document.execcommand (' Refresh ')
6,window.navigate (location)
7,location.replace (location)
8,document. Url=location.href

Ways to automatically refresh pages:
1. Page Automatic refresh: Add the following code to the
<meta http-equiv= "Refresh" content= "ten" >

10 means to refresh the page every 10 seconds.

2. Page Automatic Jump: Add the following code to the
<meta http-equiv= "Refresh" content= "10;url=http://www.baidu.com" >

10 point to 10 seconds to jump to http://www.baidu.com page

JS automatically refreshes the current page:
Copy Code code as follows:

<script language= "JavaScript" >
function Myrefresh ()
Window.location.reload ();
SetTimeout (' Myrefresh () ', 1000); Specify 1 seconds to refresh once

JS Refresh Frame Script statement
Copy Code code as follows:

Refresh the page that contains the frame with
<script language=javascript>
Parent.location.reload ();

child window refreshes parent window
<script language=javascript>
Self.opener.location.reload ();
(or <a href= "javascript:opener.location.reload ()" > Refresh </a>)

How to refresh another frame's page with
<script language=javascript>
Parent. Another FrameID.location.reload ();

To refresh or open windows when you close the window, call the following statement in <body>:
Copy Code code as follows:

<body onload= "Opener.location.reload ()" > Refresh when opening windows
<body onunload= "Opener.location.reload ()" > Refresh when closed
<script language= "JavaScript" >
Window.opener.document.location.reload ()

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.