history.back
时间: 2023-08-15 12:09:08 浏览: 57
history.back()是一个JavaScript方法,用于在浏览器中后退到上一个页面。它可以通过window.history.back()或者简写为history.back()来调用。\[1\]当使用history.back()方法后退时,原页面表单中的内容会被保留。\[2\]这意味着如果在原页面填写了表单内容,后退后再返回该页面,填写的内容仍然会存在。
#### 引用[.reference_title]
- *1* *2* *3* [vue监听浏览器返回](https://blog.csdn.net/baidu_30668495/article/details/102567984)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
相关问题
history.back()
The history.back() method is a JavaScript function that allows you to move back one page in the browser's history. This method is used to trigger the browser to navigate back to the previous page, just like clicking the back button on the browser's toolbar.
For example, if a user has navigated from page A to page B, calling the history.back() method from page B will take them back to page A.
Here's an example of how to use the history.back() method:
```javascript
function goBack() {
window.history.back();
}
```
This function can be called from a button or link on a webpage to allow the user to easily navigate back to the previous page.
window.history.back(); window.history.forward();
这两个函数是JavaScript中用来控制浏览器历史记录的方法。其中,`window.history.back()`会让浏览器返回到上一个历史记录,相当于用户点击了浏览器的“后退”按钮;而`window.history.forward()`则会让浏览器前进到下一个历史记录,相当于用户点击了浏览器的“前进”按钮。需要注意的是,这两个方法只能控制浏览器历史记录中的页面跳转,而不能直接控制页面的跳转。