Javascript Go Back to Previous Page Button Link

Go Back javascript history button links to allow visitors to go back to previous page. Here the free javascript code.

Want to add a back button navigation to your web page links. Here is how to do this using javascript and html links.

The code we’ll use look a bit like this: “javascript:history.go(-1)” .

With that code we are telling the browser to go back -1 page. You can change the -1 number to any page history like -2 or -5. So if you choose go back -3, you will send the visitor three pages back in their browser history.

Here’s the source code:

<a href="javascript:history.go(-1)">Go Back One Page </a>

Click here to try the code: Go back one page

You may also like...

4 Responses

  1. Craig says:

    I am trying to use a PHP script that cycles through images while someone is on a particular page. But when it refreshes its producing more history(only the image refreshes, but it does make more history). So if i let it sit for a few hours i'd have hundreds of page reloads and you'd never be able to click "back" fast enough or enough times to get out of the site and back to the page before you entered. Is there a way to to count the number of times a page refreshes and use your script so it just goes back "-257" times if needed?

  2. Terri says:

    Works a treat, thank you mate.

  3. Quang Tam says:

    cool Button! Thank you very much

  4. jagadesh says:

    Superb….Works great….Thanks a lot ….

Leave a Reply