OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Go to a user's very first page of browser history (stack history)

  • Thread starter Thread starter Alireza Ghadak
  • Start date Start date
A

Alireza Ghadak

Guest
I'm trying to create a button to go to the first history page but I don't know why my code doesn't work:


Code:
function firstpg() {
  var startpt = '-' + window.history.length;
  window.history.go(startpt);
}

Code:
<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
    <button onclick="firstpg()">Go First</button>
  </body>
</html>

<p>I'm trying to create a button to go to the first history page but I don't know why my code doesn't work:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function firstpg() {
var startpt = '-' + window.history.length;
window.history.go(startpt);
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html>
<head>
</head>
<body>
<button onclick="firstpg()">Go First</button>
</body>
</html></code></pre>
</div>
</div>
</p>
 

Latest posts

Top