简体   繁体   English

如何使用javascript修改特定域的现有cookie值?

[英]How to modify a existing cookie value for a specific domain using javascript?

I use this method to reset the cookie value but the method creates new cookie and modifies the same, 我使用此方法重置cookie值,但该方法创建新的cookie并修改它,

   document.cookie="leo_auth_token=" + cookievalue;

This does not set the value for the leo_auth_token i think since this cookie name comes under linkedin.com folder in cookies section. 这不会设置leo_auth_token的值我认为,因为这个cookie名称在cookies部分的linkedin.com文件夹下。

so how to modify for a specific domain or under a folder like linkedin.com 所以如何修改特定的domain或在linkedin.com这样的文件夹下

Please help me how to go about. 请帮我怎么做。

You cannot set the value of a cookie defined on another domain. 您无法设置在另一个域上定义的cookie的值。 This would be a huge security risk, and there's a good reason why you can't do this! 这将是一个巨大的安全风险,并且有一个很好的理由为什么你不能这样做!

You will need to find an alternative solution, I'm afraid. 我担心你需要找到另一种解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM