window.history对象用于返回或返回Web浏览器的下一页。它具有浏览器的历史记录,并具有以下两种方法-
history.back-转到上一个URL
history.next-转到下一个URL
您可以尝试运行以下代码以了解如何在JavaScript中使用window.history对象-
<!DOCTYPE html>
<html>
   <body>
      <script>
         function backPage() {
            window.history.back()
         }
         function nextPage() {
            window.history.next()
         }
      </script>
      <input type="button" value="Previous URL" onclick="backPage()">
      <input type="button" value="Next URL" onclick="nextPage()">
   </body>
</html>