[html5] localStorage

Ian Hickson ian at hixie.ch
Mon Dec 29 15:32:24 PST 2008


On Mon, 29 Dec 2008 roger at stat.Berkeley.EDU wrote:
>
> to the forum:
> 
> Using the most recent version of WebKit, I just tried 
> Demo3(localStorage) provided by Ian Hickson at the site:
> 
> http://www.whatwg.org/demos/2008-sept/
> 
> and it worked just as shown in the YouTube video. But I think I am 
> missing the bigger picture, because I expected that if I quit the 
> browser, and opened the file
> 
> first.txt
> 
> I would see the text I had entered into the textarea (titled "Editor"). 
> But first.txt appeared to have no text in it. Could someone explain why 
> the text was not saved into the file?

The localStorage mechanism is unrelated to files.

You can provide a file for download and saving by the user by providing a 
link to the document, e.g. using a data: URL:

   <a href="data:text/plain,demo">download file</a>

The user agent could provide the data to the user itself, too. However, 
there is no correlation between the name of the key in the localStorage 
API and any on-disk files; the use of "first.txt" in the demo was maybe 
unfortunate in this regard.

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



More information about the Help mailing list