You are here: Reference > JavaScript > client-side > browser > methods > forward (history, window)

forward method (history, window)

Browser support:
Loads the next page form the history list into the current window.
Works identically to the Forward button of the browser application. If no next page exists in the history, the forward method has no effect. The window.forward method is equivalent to the history.forward method, but the latter is only supported by Internet Explorer. Use it for cross-browser functionality.
If you want to go back in the window history list, use the back method. The go(1) can be used instead of the forward method.
Note: in Internet Explorer, the Back and Forward buttons on the toolbar are not updated after the invocation of the back and forward methods.

Syntax:

object.forward ( );
You can find the related objects in the Supported by objects section below.

Return value:

This method has no return value.

Example HTML code 1:

This example illustrates the use of the forward method:
<head>
    <script type="text/javascript">
        function GoBack () {
            history.back ();
        }

        function GoForward () {
            history.forward ();
        }
    </script>
</head>
<body>
    Click on the following anchors first to add items to the history list.
    <br />
    <a href="#target1">First anchor</a>
    <a name="target1"></a>
    <br />
    <a href="#target2">Second anchor</a>
    <a name="target2"></a>
    <br /><br />
    Use these buttons to navigate in the history list:
    <button onclick="GoBack ();">go back in the history list</button>
    <button onclick="GoForward ();">go forward in the history list</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content