Discuz has a mechanism for discuz to save post data. when sending an interrupted message, the system saves the data by itself. when you log on to the discuz console next time, the following message appears: you have not submitted data to restore the data.
I want to learn this function.
Is ajax saved to the database? Or store cookies or something?
Please advise me which codes I want to learn.
Reply to discussion (solution)
1. if it is particularly important or requires a long time to edit the content, it is recommended that setinterval ajax save the user's draft information to the database (memcache and redis are better). This can also enable the boast browser
2. if it is not important, determine whether your browser supports HTML5 localStorage stored in localStorage if it is not supported stored in cookies, but the cookie does not store too much data because each request will pass the cookie
For the first method, refer to the blog system
The second method can refer to the http://www.zhangxinxu.com/wordpress/2011/09/html5-localstorage%E6%9C%AC%E5%9C%B0%E5%AD%98%E5%82%A8%E5% AE %9E%E9%99%85%E5%BA%94%E7%94%A8%E4%B8%BE%E4%BE%8B/
1. if it is particularly important or requires a long time to edit the content, it is recommended that setinterval ajax save the user's draft information to the database (memcache and redis are better). This can also enable the boast browser
2. if it is not important, determine whether your browser supports HTML5 localStorage stored in localStorage if it is not supported stored in cookies, but the cookie does not store too much data because each request will pass the cookie
For the first method, refer to the blog system
The second method can refer to the http://www.zhangxinxu.com/wordpress/2011/09/html5-localstorage%E6%9C%AC%E5%9C%B0%E5%AD%98%E5%82%A8%E5% AE %9E%E9%99%85%E5%BA%94%E7%94%A8%E4%B8%BE%E4%BE%8B/
Random answer