Window history.forward()

Example

Create a forward button on a page:

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

The output of the code above will be:

Click on Go Forward to see how it works.
(Will only work if a next page exists in your history list)

Try it Yourself »

Description

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

The history.forward() method only works if a next page exists.

Note

history.forward() is the same as history.go(1).

history.forward() is the same as clicking "Forward" in your browser.

See Also:

The history.back() Method

The history.go() Method

The history.length Property


Syntax

history.forward()

Parameters

NONE

Return Value

NONE

Browser Support

history.forward() is supported in all browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes Yes


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.