Facebook 连接 cookie 在 Google Chrome v11 上第一页更改时消失
我一直在开发两个依赖 Facebook Connect javascript SDK 的网站。这些网站的 facebook 会话在许多浏览器上都运行良好,直到我切换到 Google Chrome 11...出于某种原因,它现在只能在“私人”模式下运行。今天,一位朋友(也使用 Mac)也遇到了同样的困难。
为了了解出了什么问题,我在登录和浏览我的网站时观察了 cookie(使用 Google Chome 的开发面板)。当我使用 Facebook 帐户登录时,会存储一个 fbs_
cookie。请求第一页时已成功传输到服务器。但是,一旦页面显示,cookie 就消失了,需要我再次使用 facebook connect 登录!
我尝试使用服务器的 set-cookie
响应标头强制此 cookie,但没有帮助。
当我使用其他浏览器(firefox、safari)或 Google Chrome 的“私人”模式时,两个网站都运行良好。
您知道该问题的原因和解决方案吗?
更新:第二天问题就消失了,无需执行任何操作...这很奇怪!
I have been developing two websites that rely on Facebook Connect javascript SDK. The facebook sessions of these websites have been working well on many browsers until I switched to Google Chrome 11... For some reason, it only works in "private" mode now. And a friend (also using a Mac) experienced the same difficulties today.
In order to understand what went wrong, I observed cookies (using the development panel of Google Chome) while logging in and navigating on my websites. When I login with my facebook account, a fbs_
cookie is stored. It is successfully transmitted to the server when requesting a first page. But, as soon as the page is displayed, the cookie disappears, requiring me to login again with facebook connect!
I tried to force this cookie using a set-cookie
response header from the server, but it didn't help.
When I use another browser (firefox, safari) or Google Chrome's "private" mode, both websites work well.
Do you have any clue about the reasons and the solution of that problem?
Update: The problem disappeared the following day, without having to do anything... That's weird!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否在每个页面上都执行 FB.Init() ?
看看这里:
http://developers.facebook.com/docs/reference/javascript/FB。 init/
并确保 cookie 参数设置为 true。
FB.init({
appId : '您的应用程序 ID',
status : true, // 检查登录状态
cookie : true, // 启用cookie以允许服务器访问会话
xfbml : true // 解析 XFBML
});
Are you doing FB.Init() on each page?
Take a look here:
http://developers.facebook.com/docs/reference/javascript/FB.init/
And ensure that the cookie param is set to true.
FB.init({
appId : 'YOUR APP ID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});