Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get back to previous page

just i want to make back button in my site. once i click the button it need to take the url in to previous page. how can i make this using jquery?

like image 728
3gwebtrain Avatar asked Jun 03 '10 17:06

3gwebtrain


People also ask

Which button is used to view old webpages?

Answer: Arrow Buttons. These two arrows navigate the browser back (the left arrow) to a previously viewed webpage or forward (the right arrow) to more currently viewed webpages. ...

Can we go back to page one?

Can't we just go back to page one and start all over again?” “The only reason for being a bee is to make honey. And the only reason for making honey is so I can eat it.”

How do I go back in URL?

The history. back() method loads the previous URL (page) in the history list.


2 Answers

<button type="button" onclick="history.back();">Back</button>
like image 196
wRAR Avatar answered Oct 05 '22 23:10

wRAR


the answer by wRAR is correct, you can use history.back or history.go(-1). However, if you are using ajax, you might need a bit more than that.

Stephen Walter has a nice article on how to use jQuery, ASP.NET, and Browser History which basically describes how to save and restore the application state yourself. I recommend you give a read.

Elijah Manor(co-host of the Official jQuery Podcast) has also written a nice article about this topic.

I hope this helps -D

like image 23
Diego C. Avatar answered Oct 05 '22 23:10

Diego C.