Summary of History objects
The history object records the pages (URLs) that the user has browsed, and enables the browser to move forward and backward with similar navigation capabilities.
Note: starting from the moment the window is opened, each browser window, every tab, and even each frame has its own history object associated with a particular window object.
Grammar:
Window.history. [Properties | method]
Note:window can be omitted.
History Object Properties
650) this.width=650; "height=" PNs "style=" Border:0px;width:459px;height:93px;clear:both; "src="/HTTP/ Img.mukewang.com/53548c030001759e05840068.jpg "/>
History Object method
650) this.width=650; "height=" "style=" Border:0px;width:428px;height:117px;clear:both; "src="/HTTP/ Img.mukewang.com/53548c200001228206210123.jpg "/>
Using the Length property, the total length of the current window's browsing history, the code is as follows:
<script type= "Text/javascript" >
var HL = window.history.length;
document.write (HL);
</script>
Return to previous browsed page
Back () method to load the previous URL in the History list.
Grammar:
Window.history.back ();
For example, to return to the previous page of the browse, the code is as follows:
Window.history.back ();
Note: The reverse button is equivalent to clicking the browser.
Back () equivalent to go (-1), the code is as follows:
Window.history.go (-1);
Return to the next browsed page
Forward () method to load the next URL in the history list.
If you want to go back to the page you browsed before going backwards, you can use the forward () method, which is the following code:
Window.history.forward ();
Note: Equivalent click forward button.
Forward () equivalent to go (1), the code is as follows:
Window.history.go (1);
Back to other pages in browsing history
The Go () method loads a specific page in the History list, depending on the page currently in place.
Grammar:
Window.history.go (number);
Parameters:
In the browser, the second history page that was browsed before the current page is returned, with the following code:
Window.history.go (-2);
Note: As in the browser, click the two-time back button operation.
In the same vein, return to the third history page that you visited after the current page, with the following code:
Window.history.go (3);
Summary of JavaScript history objects