Creating an HTML back button

HTMLAdding the code below will direct a visitor back to a page they came from. 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

  • See our push button definition for further information and related links on this term.