We all know that JavaScript has a History object, which is mainly used to record the browser window's browsing history. However, the JS script is not allowed to access the contents of this record (privacy).
The common usage is:
History.back ();//returns to the previous page, equivalent to the browser fallback function.
History.forward ();//Go to the next page, equivalent to the browser's forward function.
Histoty.go (int);//go to the specified browsing history page. int is positive, it is forward int history record, if not so many, there is no behavior. int is negative, then it's backwards.
back int records, if there are not so many times, there is no behavior. 0 I tried it without any action.
Note: The above 3 methods do not refresh the page as explained by the results you went to Baidu, which is incorrect. After I went to StackOverflow to view, but also refer to the "JavaScript authoritative guide",
Indicates that the new document is not refreshed to load. In the JavaScript authoritative guide, it is clear that modern browser applications can dynamically change their content without loading new documents. So, if it is
If you want to refresh the page state after History.back () or Histoty.go (-1), I'm sorry, we can't finish the task simply by using the history object.
After the experiment, JS's location object after using History.back (), does not mean History.back () this page, but the call History.back () This method when the page. So I want to pass the simple
Location.reaload () will not work to refresh the page. Similarly, the other several JS Refresh method is similar to the situation.
Use JavaScript's history object to implement page forward backward (Go/back/forward).