code for previous page

without writing something in script form - is there an href i can write that takes a user back to the previous page they were on - kind of like the back button on a browser does?

i am hoping to use just html code to do this.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hi naifyboy123,

You will need the addition of JS to do this, eg:

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


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



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Its a bad idea to use href="#" or href="javascript:anything" for the reasons described at
if you don't want to use javascript, you can always use: <a href="previouspageurl.html">Go Back to your previous page</a>; which is what i use.

previouspageurl.html being the page they were on before clicking the link to get to where they are now.
if you wanted something that would take them back to a search engine or something, the javascript code would better suit your needs.
naifyboy123Author Commented:
thanks Diablo - i think i will have to use your option - do i need to enter anything in the Head for this to work - or do i just enter the code in body as it is?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.