Computer >> Computer tutorials >  >> Programming >> Javascript

How to load the next URL in the history list in JavaScript?


To load the next URL in the history list, use the history.next() method in JavaScript.

Example

You can try to run the following code to load next URL −

<!DOCTYPE html>
<html>
   <body>
      <script>
         function nextPage() {
            window.history.next()
         }
      </script>

      <input type = "button" value = "Next URL" onclick = "nextPage()">
   </body>
</html>