Window history.forward() method

Definition and Usage

history.forward() The method loads the next URL (page) in the history list.

history.forward() The method is only valid when there is a next page.

Comment

history.forward() Same as history.go(1) Same.

history.forward() Same as clicking the 'Forward' button in the browser.

See also:

history.back() method

history.go() method

history.length method

Example

Create a forward button on the page:

<button onclick="history.forward()">Forward</button>

The output of the above code will be:

Click 'Forward' to see how it works.

(Only valid when there is a next page in your history list)

Try it yourself

Syntax

history.forward()

Parameter

None.

Return value

None.

Browser Support

All Browsers Support history.forward():

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support Support Support Support Support Support