back button link

I wanted to add a link to my site on each page so people can go back.

Is there an easy way to do this?

If someone went through 5 pages, and they hit the link I am going to make, how will I know to go through the 5 pages?

I don't want it to just go to the referrer.

If they go from page 1 to page 2 5 then hit back it should go to page 4, if from there they hit the back button, it should go to the previous one from page 4, which was page 3, not just back to page 5.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Try using this  in your back link and change the -1 to -5 or whatever depending on the amount of pages you want to go back:

<a href="Javascript:history.go(-1)">Back</a>
If you want to go back 1 page, use

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

for your link.  You may also want to consider having "forward" links as well, and for those, you would use

<a href="javascript:history.forward();">Forward</a>
or <a href="javascript:history.go(1);">Forward</a>

I may have misinterpereted you but it sounds like you want to go all the way to the first page in the history as well?  For that just use
<a href="javascript:history.go(-(history.length));>Go to the beginning</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
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
Web Languages and Standards

From novice to tech pro — start learning today.