Javascript History Forward Function

Updated on 23 Mar 2012,
Published on 25 Jul 2008

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.

JavaScript History Object Examples:

You can see the live samples and examples of JavaScript History Object from the following links:

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.

Output:

You can see the output of above discussed code from the following link:

JavaScript window.history.forward

Continue to next tutorial: Javascript History Go Function to learn how to perform the history back and forward action using single JavaScript function.

0 Responses to "Javascript History Forward Function"
Leave a Comment
* required
* required
* will not be published
* optional
* hint: http://www.example.com
  • Subscribe via Email