jQuery Back Button (go to previous page)

By Sam Deering

jQuery/JavaScript code snippet to simulate a back button based on the users last web page.

		return false;
Sam Deering
Meet the author
Sam Deering is a Front-end Web Developer who specialises in JavaScript & jQuery. Sam is driven and passionate about sharing his knowledge to educate others.
  • Pingback: jQuery Back Button (go to previous page) « Big Engine Media()

  • Mark “Chief Alchemist” Simchock

    Simply yet helpful, thanks.

    But what if there is no history? For example, the page’s URL is shared via social media. Might there be an easy way to suppress the displaying the link that is assigned the .back?

  • Mark “Chief Alchemist” Simchock
  • Manish

    Very useful and handy.

  • ksankalpa

    thanks a lot ,,common solution for most problems

  • mimi

    Letter Registration Form
    function goBack () { history.go(-1); return false; }

    Search By :

    (please select Your choice:…)


    Tarikh Penerimaan
    No.Fail Kementerian Ibu Pejabat
    Nombor-Nombor yang lain
    Tarikh Surat
    Daripada siapa
    Dirujukkan kepada
    Dokumen difailkan


















































    //this mycode idon’t why button back not function..

  • mimi

    not that one..sory..this one…

    KandunganForm Kandungan/Content :  

  • chandu

    history.back(); also working for mee

  • Gary

    Thanks Sam, please could you let me know where to add the code.

  • Gloumi

    You save my life, thanks!

  • Sachin

    Thanks! This really helper!

  • azerty


  • mahmoodi


  • Dinky

    thanks, mate.


Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in JavaScript, once a week, for free.