I have an ajax paginate part in my php file. I don't need to have every page remembered by the back button, but at least the last visited. In Firefox this works great. For example, I go to page 5, ajax changes the content and page number 5 is highlighted. If I then press some info on that ajax-part I go to an entirely new page and then when I press back button I go back and Firefox remembers it was page number 5.

In Explorer though it always go back to page number 1. Why is this? Remember that I don't need to be able to go through every ajax-page, for example 5,4,3,2 etc. I just want the browser to remember the last ajax-page visited.

BBQ, reallysimplehistory etc seems to be a lot of work to implement together with my existing ajax. I just want Explorer to remember my last visited ajax-page.

Is this possible?

DrV,

I think you will find it difficult to override IE's natural behaviour in this respect. In both browsers, the back button performs a "soft reload" of the page but it would appear that in FF it is softer than in IE. It appears that IE remembers form data but not DOM changes whereas FF remembers both. I'm not sure whether W3C has even considered standardising this aspect yet.

For a solution, my only thought is that current page is rememberd server-side in the Session and that the page enquires this in its window.onload handler, then acts accordingly (ie. goes to page N) ..... slighlty elaborate but maybe the only way.

Airshow

Oh yes, if IE reliably reloads form data, then store the page number in a hidden input field, then get the window.onload handler to act on that. Same idea but very slightly less elaborate.

You could always try the two methods in cascade, in case the first fails.

Airshow

I'm trying to solve it with sessions as of right now and it works. Unfortunately other variables are nullified so I have to include them as well. More work...

DrV,

Excellent - sounds like partial success. Now that you have one variable working, it should be fairly simple to do the same with others. With a litle thought, it should be very simple (using an array of form element names, probably).

It is quite common, when filling mult-page forms on the web, to be advised "don't use your browser's back button". The reason is exactly what you have discovered - browsers have different behaviours.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.