Javascript Reference - History forward() Method








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

Browser Support

forward Yes Yes Yes Yes Yes

Syntax

history.forward()

Parameters

None.

Return Value

No return value.





Example

The following code shows how to create a forward button on a page.


<!DOCTYPE html>
<html>
<head>
<script>
function goForward() {<!-- w w  w.  j a  v a  2  s.  c  o m-->
    window.history.forward()
}
</script>
</head>
<body>
<button onclick="goForward()">Go Forward</button>
</body>
</html>

The code above is rendered as follows: