You are here: Reference > JavaScript > client-side > browser > properties > next (history)

next property (history)

Browser support:
Returns the URL of the next document in the history array.
This property requires the UniversalBrowserRead privilege. When the current document is the last item in the history array, the use of the next property raises an exception.

Syntax:

object.next;
You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

String that represents the location.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the next property:
<head>
    <script type="text/javascript">
        function GetNextURL () {
                // UniversalBrowserRead privilege is required in Firefox
            try {
                if (window.netscape && netscape.security) { // Firefox
                    netscape.security.PrivilegeManager.enablePrivilege ("UniversalBrowserRead");
                }
            }
            catch (e) {
                alert ("UniversalBrowserRead privilege is required in Firefox!");
                return;
            }

            try {
                if ('next' in window.history) {
                    alert (window.history.next);
                }
                else {
                    alert ("Your browser does not support this example!");
                }
            }
            catch (e) {
                alert ("The current document is the last item in the history array!");
            }
        }
    </script>
</head>
<body>
    <button onclick="GetNextURL ()">Get the next URL!</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content