Why are cookies unrecognized when a link is clicked from an external source (i.e. Excel, Word, etc…)

后端 未结 17 2680
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-28 04:39

I noticed that when a link is clicked externally from the web browser, such as from Excel or Word, that my session cookie is initially unrecognized, even if the link opens u

17条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 05:03

    We had this same problem and wrote an open source gem to help those using rails: https://github.com/spilliton/fix_microsoft_links

    You can use the same approach we used on any framework though:

    1. Detect if the user agent is from a Microsoft product
    2. Render a blank html page with a meta refresh tag that will cause the browser to refresh the page with the correct cookies

    Example code here: https://github.com/spilliton/fix_microsoft_links/blob/master/lib/fix_microsoft_links.rb

提交回复
热议问题