admin管理员组文章数量:1401208
I want to use localStorage on the client side and right now I am sending that data in the body of an AJAX request. However, it would be nice to be able to send the data with the page request. Is there a way to place localStorage data (or I guess any data) in the HTTP header such that I can read it with Javascript and store it in localstorage?
I want to use localStorage on the client side and right now I am sending that data in the body of an AJAX request. However, it would be nice to be able to send the data with the page request. Is there a way to place localStorage data (or I guess any data) in the HTTP header such that I can read it with Javascript and store it in localstorage?
Share Improve this question asked Sep 26, 2014 at 17:44 Justin ElkowJustin Elkow 2,9438 gold badges32 silver badges62 bronze badges2 Answers
Reset to default 5There is no automatic way to put something in local storage by passing an HTTP header.
Your idea of reading the header with JavaScript won't work either, assuming you're referring to the page that the JavaScript is running on. The JavaScript has no way to get the response headers directly.
You could always load your data via AJAX or similar.
only with cookie like schoolbus from localstorage to server and back
本文标签: javascriptCan localstorage data be placed in the HTTP headerStack Overflow
版权声明:本文标题:javascript - Can localstorage data be placed in the HTTP header? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744288851a2599016.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论