Javascript Browser History go() Method with number parameter

Introduction

Go forward one page

This example will not work if the next page does not exist in the history list:

window.history.go(1);

View in separate window

<!DOCTYPE html>
<html>
<body>
<button onclick="goBack()">Load the next URL in the history list</button>
<script>
function goBack() {/*  w ww. j  av a2s . com*/
  window.history.go(1);
}
</script>

</body>
</html>



PreviousNext

Related