How do I have a link go to a previous page from JavaScript?

John Zukowski

You can either use the history.back() method or history.go(count), where -count says how many pages to go back.

  • <a href="#" onClick="history.back(); return false;">Back to Last Page</a>
  • <a href="#" onClick="history.go(-3); return false;">Go Back 3 Pages</a>
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.