Go Back to Previous Page

The code sample shows a simple code to enable the user to navigate back to the previous page.


<input type="button" value="Back to Previous Page" onClick="javascript: history.go(-1)">

The code uses the "history" object provided by the DOM of the web browser. History object's go () method takes -1 as argument to signify the previous page.
The output of the above example can be readily seen below


Author: vilas fulzele30 Jul 2008 Member Level: Silver   Points : 0

very nice code.
This code is helpful for me.

Author: Ultimaterengan01 Aug 2008 Member Level: Gold   Points : 1

Really very nice one.
continue for sharing your knowledge


Ultimate Rengan

Author: dlna05 Jun 2009 Member Level: Bronze   Points : 1

This would create a simple button in the designer.

Is it possible to do the same function in an Imagebutton. I tried but it didnt really work.

Could you please help me in figuring this out.

PS: I'm really new into programming and dont know much.

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: