Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Go back button in a page [duplicate]

Tags:

javascript

Possible Duplicate:
Go Back to Previous Page
get back to previous page

How to get the previous page in javascript coding. Go to the previous page when click that back button.

like image 742
Rithu Avatar asked Nov 22 '12 11:11

Rithu


2 Answers

Here is the code

<input type="button" value="Back" onclick="window.history.back()" />  
like image 158
Ramya Avatar answered Sep 29 '22 09:09

Ramya


You can either use:

<button onclick="window.history.back()">Back</button> 

or..

<button onclick="window.history.go(-1)">Back</button> 

The difference, of course, is back() only goes back 1 page but go() goes back/forward the number of pages you pass as a parameter, relative to your current page.

like image 40
George Avatar answered Sep 29 '22 10:09

George