Javascript History forward function loads the next URL saved in the history array list of URLs in the web browser history visited by the user. History forward function of javascript performs the same action as the forward arrow button of the web browser. But remember that javascript history forward function loads the page from the cached version of the web page stores at the client side. It does not load the updated version of the web page if in the mean time original content of the web changes online.
Syntax for Javascript History Forward Function
history.forward();
or
window.history.forward();
forward function of history object can also be accessed using window object of javascript.
Example of Javascript History Forward Function
<html>
<head>
<title>Javascript History Object Forward Function</title>
</head>
<body>
<input id="btnForward"
type="button"
value="Forward"
onclick="history.forward();" />
</body>
</html>
Above example creates a forward button on the HTML web page. onclick event is used to redirect the user to next URL of the web browser history.
Continue to next tutorial: Javascript History Go Function to learn how to perform the history back and forward action using single JavaScript function.