Window.history.go (0)
The page can be returned to the previous page when it calls Window.history.go (-1);
When the page can not use the "back" button to close the window,
This is mainly because this page may be a newly opened window, or it may have been opened in the window of the previous page.
---------------------------------------------------------------
For security purposes, the history object does not give the actual URL of the browser's history. This object provides only the ability to navigate through the back, forward, and go methods in browser history. A specific document in browser history can be represented by an index value that is relative to the current page. For example, specifying 1 as a parameter to the Go method is the same as clicking the Back button.
---------------------------------------------------------------
alert (document.referrer);
---------------------------------------------------------------
Can be sentenced?? is the Ocument.referrer value the Champs-cutter?
---------------------------------------------------------------
if (History.length = = 0) window.close ();
| The code is as follows |
Copy Code |
<input Type=button value= Refresh onclick= "Window.location.reload ()" > <input Type=button value= forward onclick= "Window.history.go (1)" > <input Type=button value= back onclick= "Window.history.go ( -1)" > <input Type=button value= forward onclick= "Window.history.forward ()" > <input Type=button value= back onclick= "Window.history.back ()" >
|
Back + Refresh
| The code is as follows |
Copy Code |
<input Type=button value= back onclick= "Window.history.go ( -1); Window.location.reload ()" >
|
In a C # Web program, such as returning the previous page of code for a page button write
| The code is as follows |
Copy Code |
This. RegisterClientScriptBlock ("E", "<script language=javascript>history.go ( -2);</script>"); |
Where, History.go (-2) is written as-2, the page is refreshed once before the button event is triggered, so it should be-2.
| The code is as follows |
Copy Code |
Response.Write ("<script language=javascript>history.go ( -2);</script>"); |
This is also written as "-2". differs from direct write scripts.
History.back () is the previous page
I=1
History.go (i) go to the designated night
If it's History.go (0) that's refreshing.
These two belong to JS code, the equivalent of IE's forward and backward function.
The specific use depends on when you need it. For example, when the user registration verification is the background verification, does not meet the requirements of the time can use this, can maximize the user to ensure that less repeated input data.
For example: Load page:
| The code is as follows |
Copy Code |
| function Onloadpage () { if (event.srcelement.tagname== "SPAN") { OFRAME=TOP.WINDOW.MIDDLE.FRAMES[2]; Otxt=event.srcelement.innertext; Switch (otxt) { Case "forward": OFrame.history.go (1); Case "Back": OFrame.history.back (); Case "Refresh": OFrame.location.reload (); } } } <a herf= "Javascript:window.history.go ( -1)" > Return to Previous page </a> |
Window.location.reload ()
Window.location.href=location.href
Window.location.assign (LOCATION.HREF)
Document.execcommand (' Refresh ')
Window.navigate (LOCATION.HREF)
Window.navigate ("#pos");
Window.location.replace (LOCATION.HREF)
window.open (' own file ', ' _self ')
————-
Location.reload (flag)
Flag =true not read from cache
=false read from cache