Re: Ajax Back/Forward History problem - saving document state by document.save()

Karl Pongratz wrote:
>
> Hmm, Jim Ley says something similar what the documentation does:
> "and it requires scripting to sync the local state with what they want
> it to be, and local storage to persist the information,"
>
> Though you say it saves the DOM. Why would I need scripting and probably
> rebuild the DOM if the DOM state is saved?
>
> Do I misunderstand something?

The pushState method takes a DOMobject, which as I understand can be
the entire DOM or just a portion of it. It saves this into the browser
history.

Then when the user clicks the back button, the PopStateEvent is fired.
You have to catch that event and access it's state property. The state
property holds the DOMobject you paced in when you called the
pushState. Then do with the DOMobject what you want. It dosn't ust
magicly remeber the state of the page and restore it for you without
any scripting on your part. Or at least that's how I understand it.

Kenny

Received on Tuesday, 22 November 2005 21:24:14 UTC