Go back button in a page

Javascript

Javascript Problem Overview


> 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.

Javascript Solutions


Solution 1 - Javascript

Here is the code

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

Solution 2 - Javascript

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.

Solution 3 - Javascript

There's a few ways, this is one:

window.history.go(-1);

Solution 4 - Javascript

onclick="history.go(-1)" Simply

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRithuView Question on Stackoverflow
Solution 1 - JavascriptRamyaView Answer on Stackoverflow
Solution 2 - JavascriptGeorgeView Answer on Stackoverflow
Solution 3 - JavascriptnickfView Answer on Stackoverflow
Solution 4 - JavascriptvusanView Answer on Stackoverflow