English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript History back() Method

HTML History Object

back()method to load the previous URL in the history list.

This is the same as loading the previous URL in the history list in the browser or by using the-1Clicking the 'Back' button in the parentheses is the same as clicking

Note:This method will not work if the previous page is not in the history list.

To load the next URL in the history list, usehistory.forward()Method.

Syntax:

history.back()
<button onclick="history.back();">Go Back</button>
Test to see‹/›

The following output will be displayed by the above code:

Browser Compatibility

All browsers fully support the back() method:

Method
history.back()YesYesYesYesYes

Technical Details

Return Value:None

Related References

History Record Reference:history.forward() Method

History Record Reference:history.go() Method

HTML History Object