Create a forward button on a page.
This example will not work if the next page does not exist in the history list:
<!DOCTYPE html> <html> <body> <button onclick="goForward()">Go Forward</button> <script> function goForward() {/* w w w. j a v a 2 s .c o m*/ window.history.forward(); } </script> </body> </html>
The forward()
method loads the next URL in the history list.
This is the same as clicking the "Forward button" in your browser, or history.go(1).
This method will not work if the next page does not exist in the history list.
history.forward();