【问题标题】:Cookies doesn't appears in Chrome Console Resources tabCookie 未出现在 Chrome 控制台资源选项卡中
【发布时间】:2014-02-08 02:13:51
【问题描述】:

我正在使用 Grails 应用程序并创建不同的 cookie。

有些出现在 chrome console Resources TAB 中,有些没有显示。

我需要使用 Angularjs 获取这些 Cookie 的值,并且只能访问在 console Resources TAB 上显示的那个。

其他 cookie 在 Chrome Content settings button 中可见。 在Cookies section 中,但不在Chrome 中console Resources TAB

所有 cookie 的创建方式都相同:

Cookie cookie = new Cookie("username", username)
cookie.maxAge = 1209600 //14 days
cookie.httpOnly = true
response.addCookie(cookie)

感谢您的帮助。

【问题讨论】:

    标签: javascript angularjs google-chrome grails cookies


    【解决方案1】:

    好的,问题是路径。要在所有页面中可见,路径必须是 "/"

    cookie.setPath("/")
    

    【讨论】:

    • 在 2017 年 9 月仍然适用!
    猜你喜欢
    • 1970-01-01
    • 2014-02-25
    • 1970-01-01
    • 2016-05-06
    • 1970-01-01
    • 2011-06-15
    • 2023-03-12
    • 2014-02-06
    • 2015-02-08
    相关资源
    最近更新 更多