HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

History forward() Method

History Object Reference History Object

Example

Create a forward button on a page (This example will not work if the next page does not exist in the history list):

<script>
function goForward()
  {
  window.history.forward()
  }
</script>

<body>
<button onclick="goForward()">Go Forward</button>
</body>

The output of the code above will be:


Try it yourself »

Definition and Usage

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

This is the same as clicking the "Forward button" in your browser, or history.go(1).

Note: This method will not work if the next page does not exist in the history list.

Tip: To load the previous URL in the history list, use the history.back() method.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The forward() method is supported in all major browsers.


Syntax

history.forward()

Parameters

None.

Return Value

No return value.


History Object Reference History Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE