Problem with window.history.back()

Posted on 2004-11-03
Last Modified: 2010-05-18
I have used a "return" button with the Javascript code window.history.back() to return the user to the previous page, in the same way as if they pressed the back button.

I appears that for some users, this is apparently not working, and in fact backs them up several pages. I am wondering what the problem is, as on our test systems, this never occurs.

In particular, I am wondering if this problem could be browser specific, such as with Safari, as I have seen certain times when such things don't work right with this browser.
Question by:jasimon9
    LVL 31

    Expert Comment

    try   history.go(-1)
    LVL 5

    Expert Comment

    try window.history.back(-1) to control browser to go back for 1 page only.

    LVL 13

    Accepted Solution

    you can try following


    Author Comment

    I am going out of town for a few days. Won't be able to evaluate the responses until new week.

    Author Comment

    I have tested the history.go(-1) version and it does not break our existing page behaviour. Unfortunately, we cannot reproduce the problem on our system, so we will not know whether it corrects the problem for "certain" users, unless over a long period of time the complaints do not continue.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (, typical array handling might look like this: (CODE) B…
    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now