Creating an HTML back button
Insert the following HTML into your web page:
<form> <input type="button" value="Go back!" onclick="history.back()"> </form>
The result will look like the button below. If you click it, you'll go back to the previous page in your history.
The history.go() method tells the browser to go to a specific page in the user's browsing history. You can specify which history item by putting a number inside the parentheses. In computer programming, this is called an argument.
If you specify the number -1 as your argument, the browser will go back one page in the browser's history. Here's the same code as above, using history.go(-1) instead of history.back().
<form> <input type="button" value="No, really, go back!" onclick="history.go(-1)"> </form>