Friday, May 6, 2011

Firefox back button works only the first time, not the second time

Hi,

I have a website where you can search on stuff with dates and more. When I post the form I get to a result-page, when I hit the back button I go back to my search-page and will refill the values. This works in IE and FF.

however, whatever I do, when I search and go back again the second time, the values are lost in Firefox, while IE and other browsers still remember the filled-in values. whatever I do on the search-page, it doesn't rememeber the new state, but only the original first-state. Even when I check teh form-values before posting it, it shows the correct-values, but when returning it is lost.

From stackoverflow
  • Ok,

    I made a clean testcase without all the extra stuff I have and came to the simple conclusion it the # that caused the confusion and my problem.

    when you do

    <a href="#" onclick="DoSomethingFirstBeforeSubmittingTheForm()">Go!</a>
    

    Firefox goes back to the .html variant of the page, while IE goes back to the .html# variant of the page.

    while when you do

    <a href="javascript:DoSomethingFirstBeforeSubmittingTheForm()">Go!</a>
    

    both FF and IE go back to the html-page, and using the correct-cache.

    Mike Robinson : Add "return false;" to the end of your function, it'll stop the link from performing it's action

0 comments:

Post a Comment