开发者

How to implement Stack Overflow textarea that will restore your typing when asking a question after you close and reopen it

Implement it with HTML5 storage? Constantly upload to server session?

Which is a better a开发者_JS百科pproach?


HTML5 storage? Yes you can, but it won't be supported by old browsers. Another ways of doing that are:

  1. Store draft into cookies every n seconds.
  2. Store draft at server side using ajax requests every n seconds.


Or you could use one of these frameworks:

  • PersistJS
  • Sammy
  • and many others (a quick search in github and google code should give you other anwsers)

They provide a persistent storage API in the browser, with various implementations/fallback dependening on the browser (cookie, localStorage, jquery data, adobe flash, google gears...)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜