showing results for - "javascript window history"
Max
16 Jan 2020
1// go back:
2window.history.back()
3// go forward:
4window.history.forward()
5// go to specific point:
6window.history.go(-2) // go back 2 pages, 0 is current page
7window.history.go(0) // refreshes current page
8window.history.go() // refreshes current page
9// get number of pages in history
10let numberOfEntries = window.history.length
11
Pia
06 Apr 2016
1var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?newParameter=1';
2window.history.pushState({ path: newurl }, '', newurl);
Sophie
14 Jun 2016
1<html>
2<head>
3<script>
4function goBack() {
5  window.history.back()
6}
7</script>
8</head>
9<body>
10
11<input type="button" value="Back" onclick="goBack()">
12
13</body>
14</html>