从其他路径检索Cookie

从其他路径检索Cookie

本文介绍了从其他路径检索Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我当前的文档URL是http://127.0.0.1/foo,我需要为http://127.0.0.1/bar更改cookie的值.document.cookie为空,因为文档的URL为foo.目前,我只想读取cookie值.有任何线索吗?

My current document URL is http: //127.0.0.1/foo and I need to change the value of a cookie for http: //127.0.0.1/bar.document.cookie is empty because document's URL is foo.For the moment, I just want to read the cookie value.Any clue?

推荐答案

创建cookie时,如果将路径设置为"/"而不是"foo",则可以在域中的任何位置读取它,包括'/foo','/bar'等

When you create the cookie, if you set the path to '/' instead of 'foo' you will be able to read it anywhere on the domain, including '/foo', '/bar', etc.

这篇关于从其他路径检索Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 12:03