EN
JavaScript - navigate multiple pages back
3 points
In this article, we would like to show you how to navigate multiple pages back using JavaScript.
Quick solution:
xxxxxxxxxx
1
<button onclick="history.go(-2)">
2
Navigate 2 pages back
3
</button>
In this example, we use history.go(-2)
to navigate two pages back.
xxxxxxxxxx
1
2
<html>
3
<body>
4
<button onclick="history.go(-2)">
5
Navigate 2 pages back
6
</button>
7
</body>
8
</html>
Note:
Change the
history.go()
argument value to navigate one (-1
), three (-3
) etc. pages back.