Creating an HTML back button

Updated: 04/26/2017 by Computer Hope

HTMLAdding the code below will direct a visitor back to the page they used to open your page. For example, this is a great feature to add to any error page to help get the visitor back to a working page.

Copy and paste the below source code to add this button to your web page or blog.

<FORM><INPUT Type="button" VALUE="Back" onClick="history.go(-1);return true;"></FORM>

In the above code, the -1 tells the browser to go back one page.

Note: If the page has no previous page, e.g. it was opened in a new tab, this button does nothing.


Additional information