Creating an HTML back button

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.

Example

Additional information

  • See our back and push button definitions for further information and related links.