History back() Method

Create a back button on a page

Definition and Usage

The history.back() method loads the previous URL (page) in the history list.

The history.back() method only works if a previous page exists.

Note

history.back() is the same as history.go(-1).

history.back() is the same as clicking "Back" your browser.

See Also:

The history.forward() Method

The history.go() Method

The history.length Property

Syntax

history.back()

Parameters

NONE

Return Value

NONE

Browser Support

history.back() is supported in all browsers:
Chrome IE Edge Firefox Safari Opera
Yes Yes Yes Yes Yes Yes