Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
152 views
in Technique[技术] by (71.8m points)

javascript - Storing persistent data in browser

For my web application, I need to store form inputs spanning across multiple pages, until I finally process/manipulate them to produce some results (its mostly formatting the data entered and presenting it in some layout). The options I think I have are -

  1. Keep sending user's inputs to the server, store it there in some database, do the final manipulation there only, and show the result.

  2. Store the inputs in browser's storage as the user fills the forms, and finally use this stored data to manipulate and show results.

I very much want to use the second method, and perhaps a possible way is using cookies, but I'm afraid I might just hit some upper limit of cookie data storage. I'm also open to understanding the merits of the first method, or any third method.

thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Use webstorage (you can client-side store around 5MB of text or binary data)

Firefox demo: http://codebase.es/test/webstorage.html

DOM Storage is supported in these web browsers:

  • Internet Explorer 8
  • Firefox 2 for sessionStorage, 3.5 for localStorage
  • Safari 4

Just google for sessionStorage and localStorage objects.

Also modern webkit browsers supports client-side sql.

Edit:
I'm not sure about what you want to do but using AJAX you can store everything in javascript variables and serverside databases or sessions are a good choice.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...