HOME       >>       Programming

I Forgot A Code History -1


What's the code I use on a link to go back to previous page?


Either one of those should work:

<a href="#" onClick="history.back()">Back</a><a href="#" onClick="history.go(-1)">Back</a>


Hey uh.. bjrn, is that JavaScript? Also, what's up with that a href='#' thing? I mean, why is it '#' and not just ''? Sorry Amezis, I don't mean to take over your topic. >_>


There's another way to do that, but it's still the same thing:

<a href="javascript:history.back(1);">Back</a><a href="javascript:history.go(-1);">Back</a>

That one just doesn't use the # in the code. I think JavaScript is the only way to do that (Correct me if I'm wrong). If I made a mistake, please let me know, as I don't normally use this code.


Thanks alot! I'll try the code


wooow is that jokeEvery browers has nexk nad preview page buttoni think its old scriptand its jsp script but i think you can make easy link next and back in every pages woow if you had 10000 page its really funyou can find jsp code that automatic insert next and back pages on your page


I know that, lol, but some people are too dumb to click on the back button... And on my 'error'-pages (like 403,404 etc), I use a link with 'back'...


It has nothing to do with JSP. It is plain java script.yeah, true that u can use the back button. but in certain cases, you need to go back on certain event on the page.. it can be used then. Also giving a link to previous and next pages is desired sometimes(previous just for good gui design) . for next you need to go back to server, but for the previous a simple javascript wud do, since it is available right there....Cheers


Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.