[whatwg] Some likeness of DOM Session scope

Ian Hickson ian at hixie.ch
Wed Sep 7 15:01:29 PDT 2005


On Thu, 21 Apr 2005, Olav Junker Kjær wrote:
> > 
> > Anyone have any concrete proposals? :-)
> 
> How about a javascript structure which may be arbitrary deep, but only 
> may contain javascript built-in types (Object, Array, string, number, 
> bool, Date etc.)? This would be very easy to use, although it might be 
> confusing for authors that you can save a string but not e.g. a 
> textnode.

That's vaguely what I ended up doing, though I actually did allow Nodes as 
well by special-casing them. (Haven't mentioned Arrays though, should I?)


> A web page with an URL should be "reentrant", e.g. if you bookmark it 
> and visit it later, it should work. Pages which is dependent on info 
> generated on other pages should either have that info encoded in the 
> URL, or be accessed through a POST request. In the first case, the 
> context is preserved, in the second the page can't (easily) be 
> bookmarked and revisited, since browsers treats pages which is the 
> result of a POST request differently, which avoids the problem of the 
> missing context.
> 
> Ordinary web sites are usually "stateless" in the sense that you can 
> visit the pages in any order. Stateful transactions (like payment) are 
> usually handled as a sequence of POST's.
>
> Web applications on the other hand are usually very stateful, but 
> precisely because they are usually confined to a single page with a 
> single URL, you dont get the "reentrance" problem. You can only bookmark 
> the initial state, which is safe.

Yes.


> If an app spans several pages with distinct URL's, but is stateful in 
> such a way that pages are dependent on local state generated on earlier 
> pages, it gets very fragile. We might start to see lots of "You seem to 
> be visiting this page out of context" messages on Google :-)

This is already a problem, even with just cookies. I'm not sure how we can 
solve it, though.


> Thats not to say that the proposal is a bad idea. I see some very strong 
> use cases for it. For example, I might have written half a page of text 
> in a CMS, but when i hit "save", I'm informed that the network 
> connection is broken, and it wont get fixed before monday. In this case 
> it would be very nice if the client side script could save data in a 
> persistent local store - only accesible to this page, of course.

Exactly. This should now be possible with globalStorage[].

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


More information about the whatwg mailing list