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

JavascriptWeb DevelopmentFront End Scripts

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

Example

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

 Live Demo

<!DOCTYPE html>
<html>
   <body>
      <script>
         function backPage() {
            window.history.back()
         }
         </script>
         <input type = "button" value = "Previous URL" onclick = "backPage()">
   </body>
</html>
raja
Published on 26-Feb-2018 07:14:18

Advertisements