简体   繁体   English

Outlook 加载项 cookie 在桌面应用程序中清除,但为什么 localStorage 有效?

[英]Outlook Add-in cookies cleared in desktop app, but why localStorage works?

Related question: Outlook Web add-in - localstorage is cleared between messages相关问题: Outlook Web 加载项 - 在邮件之间清除本地存储

My question here is why are cookies cleared but localStorage retained for Outlook Add-ins used on the Outlook desktop app?我的问题是为什么 cookie 被清除,但 localStorage 保留用于 Outlook 桌面应用程序上使用的 Outlook 加载项? I would have thought that both would have worked in the same way.我原以为两者都会以相同的方式工作。 It seems to me that clearing cookies is a bug in the way Outlook uses the Edge webviews.在我看来,清除 cookie 是 Outlook 使用 Edge webviews 的方式中的一个错误。

By cookies, I believe you are referring to session cookies.通过 cookie,我相信您指的是会话 cookie。 In other words, cookies without an expiry date.换句话说,cookies 没有到期日。 When the add-in is closed, the underlying browser is also closed, hence the session cookies are deleted.当加载项关闭时,底层浏览器也会关闭,因此会话 cookie 将被删除。 More info on cookie lifetimes here .有关 cookie 生存期的更多信息,请点击此处 You can compare this behavior to sessionStorage, not localStorage.您可以将此行为与 sessionStorage 进行比较,而不是 localStorage。 So, try setting an expiry date on your cookies to preserve them beyond the add-in session.因此,请尝试为您的 cookie 设置一个到期日期,以在加载项会话之外保留它们。

Keep in mind that we don't preserve session cookies for the entire item session (or Outlook session).请记住,我们不会为整个项目会话(或 Outlook 会话)保留会话 cookie。 We only preserve them for the lifetime of the add-in instance.我们只在加载项实例的生命周期内保留它们。

Refer to this similar known issue for more information: https://github.com/OfficeDev/office-js/issues/846有关更多信息,请参阅此类似的已知问题: https : //github.com/OfficeDev/office-js/issues/846

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

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