javascript - How to modify cookies?
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-19 10:26:56
0
3
543

Ask the master, for example, in the following http request request headers information, is it possible to get the value of this cookie through js? Please tell me whether to modify this Cookie value using js!

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(3)
漂亮男人

First of all, you need to check whether the message has set httpOnly,如果设置了这个属性,那么在客户端是无法通过js读取甚至是操作cookie信息的。设置这个字段主要是为了防止xss注入攻击,防止cookie信息被盗取。
如果没有设置httpOnly属性,就可以通过浏览器提供相关的APIcookie进行操作,也可以使用一些第三方的库来对cookie information when the backend returns, for example, https://github.com/js-cookie/...

習慣沉默

Check in the developer tools to see if it is http only. If it is http only, js cannot be read or written.

Peter_Zhu

http only js cannot read and write

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template