1, a link to use the operation:
<a href= "Javascript:history.go (-1);" > Back to Previous page </a>
<a href= "#top" > Refresh current page </a>
#top的效果在我这没起作用, I wrote directly to <a href= "" > Refresh current page </a> it worked.
2., JS How to refresh the current page
Reload method that forces the browser to refresh the current page.
Syntax: Location.reload ([Bforceget])
Parameters: Bforceget, optional parameter, default to False, take the current page from the client cache. True to get the latest page from the service, equivalent to the client-click F5 ("Refresh")
Replace method, which replaces the item currently cached in history (the client) by specifying a URL, so after you use the Replace method, you cannot access the URL that has been replaced by "forward" and "back".
Syntax: Location.replace (URL)
In practical applications, when refreshing the page, we usually use: Location.reload () or History.go (0). Because this practice is like the client point F5 Refresh the page, so the page method= "POST", will appear "page expiration" hint. That's because the session's security protection mechanism. It can be thought that when the Location.reload () method is invoked, the ASPX page already exists in the server memory, so it must be IsPostback. If this applies: we need to reload the page, which means we expect the page to be recreated on the server side, and we expect it to be not IsPostback. Here, Location.replace () can complete this task. The replaced pages are regenerated each time on the server side.
You can write this: Location.replace (LOCATION.HREF);
Go back and refresh the page:
Location.replace (Document.referrer);
Document.referrer//URL of previous page
Do not use History.go (-1), or history.back (), to return and refresh the page, both of which do not refresh the page.
Report:
JavaScript refreshes the page in several ways:
1 history.go (0)
2 Location.reload ()
3 location=location
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= ">"
20 of which means that the page is refreshed every 20 seconds.
2. Page Automatic Jump: Add the following code to the <meta http-equiv= "Refresh" content= "20;url=http://www.wyxg.com" >
20 of which refers to 20 seconds after the jump to the http://www.wyxg.com page
3. Page automatically refresh JS version
<script language= "JavaScript" >
function Myrefresh ()
{
Window.location.reload ();
}
SetTimeout (' Myrefresh () ', 1000); Specify 1 seconds to refresh once
</script>
JS Refresh Frame Script statement
How to refresh the page that contains the frame with
<script language=javascript>
Parent.location.reload ();
</script>
child window refreshes parent window
<script language=javascript>
Self.opener.location.reload ();
</script>
(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 ();
</script>
If you want to close the window or refresh when you want to open windows, call the following statement in <body>.
<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 ()
</script>