使用Javascript的document.cookie不与自定义路径工作 [英] Javascript document.cookie not working with custom path
本文介绍了使用Javascript的document.cookie不与自定义路径工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面的语句工作,并将其设置cookie。
The following statement working and it setting the cookie.
document.cookie = "vcrcjode=118b11a9b3; expires=Sat,
02 Nov 2013 21:23:59 GMT; path=/";
但同样的语句不同的路径不工作。
But the same statement with different path not working.
document.cookie = "vcrcjode=118b11a9b3;
expires=Sat, 02 Nov 2013 21:23:59 GMT; path=/tag/";
这两种说法不产生任何错误。为什么第二个语句不工作?
Both statement not generating any errors. Why second statement not working?
推荐答案
在我上面$ C C I从控制台谷歌浏览器测试的测试。
When i tested above code i was testing from Console in Google Chrome.
这两个语句设置cookie,但它只能在控制台显示,当我们浏览/标签/目录。
Both statement is setting the cookie but it only show in console when we navigate to /tag/ directory.
这篇关于使用Javascript的document.cookie不与自定义路径工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文