开发者

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

开发者 https://www.devze.com 2023-03-22 11:01 出处:网络
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 d

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

精彩评论

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