[whatwg] pushState

On Fri, 25 Jul 2008, Jonas Sicking wrote:
> 
> What is the purpose of the 'title' argument? Is the idea that the UA 
> will show that where it usually shows the <title> of the page? If so the 
> title isn't purely advisory as it should probably affect document.title 
> as well. This would seem like a good idea to me.

The idea is to use this title in the session history. It's distinct than 
the <title> and document.title because when the session history might need 
to say something like "Mail - after opening 'compose mail'", "Mail - after 
typing paragraph ending in 'JSON-ifyable object.'", and so forth, while 
the whole time the actual page title just says "Mail - New Mail".


> What is the purpose of the url attribute? Why would you want to reload a 
> separate page when returning to a given state, then what was used to 
> load that state initially?

If the Document gets discarded (e.g. it gets evicted from the bfcache), 
the URL allows the client to still pretend it has the state, allowing the 
server to regenerate it based on the data in the URL.

Also, the URL can be used when bookmarking the page. It could also be 
displayed in the location bar. (The Location object should not be updated, 
however.)


> I would like to store the session states created using pushState on disk 
> so that the state can be restored in the event of a crash or a restart. 
> The only thing that would be needed to support this is that the 'data' 
> object is a string rather than a generic object. This is because a 
> generic object can't be serialized and saved to disk. Actually, what 
> would be even better is if the API accepted a string or a JSON-ifyable 
> object.

That's what the URL is for.

The data will, in many non-trivial cases, be some very complex object with 
actual Object references and pointers to DOM nodes and so forth. Imagine, 
for instance, a text editor using this. I don't think we want to require 
that the data be "plain structured data" (is there a term for this better 
than "JSON-ifiable"?), as that would preclude a number of complex cases.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 25 July 2008 12:01:43 UTC