Facebook应用程序适用于所有浏览器,但不是IE8 [英] Facebook app works on all browsers but not IE8

查看:334
本文介绍了Facebook应用程序适用于所有浏览器,但不是IE8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Facebook应用程式。 stragnly,应用程序在大多数浏览器上工作正常(我测试了它的FF,chrome和safari,它工作正常)。然而,当我在IE8测试时,我收到这个错误信息,当试图对其中一个页面进行ajax调用:

 致命错误:未捕获异常:102:需要在
中的用户会话/home1/website/public_html/facebook/src/facebook.php第515行

这是比 facebook.php 中的第515行的功能:

  protected function _restserver($ params){
//通用应用程序级参数
$ params ['api_key'] = $ this-> getAppId();
$ params ['format'] ='json-strings';

$ result = json_decode($ this-> _oauthRequest(
$ this-> getApiUrl($ params ['method']),
$ params
),true);

//返回结果,抛出错误
if(is_array($ result)&&& isset($ result ['error_code'])){
throw new FacebookApiException($ result);
}
return $ result;
}

我的猜测是,它是与会话或与IE8设置但我不知道如何解决这个问题。

解决方案

尝试在您的PHP文件的顶部添加这个标题:

 <?php 
header('p3p:CP =NOI ADM DEV PSAi COM NAV OUR STOR IND DEM );
?>

这将使跨域AJAX调用在IE中工作



编辑:



其实长的正确答案如下:



在开发IFrame Canvas应用程式(或其他网域中托管的任何其他iframe)时,在某些条件(默认IE配置)下访问Cookie(称为第三方Cookie)受到限制。 Firefox,Chrome,Safari,Opera都能正常工作,但IE阻止访问此Cookie。此标题的存在(称为 P3P紧凑型隐私政策)将使IE接受来自不同域的Cookie。 / p>

而这又如何使你的会话代码工作呢?



很好地在服务器中保存会话信息,页面发出存储在客户端中的会话cookie。如果您的iframe使用会话,则浏览器必须允许它存储cookie。



下降到存储cookie意味着会话将丢失,并且基于会话



希望这有助于。



PS:BTW我不知道所有奇怪的首字母缩写p3p头中的意思。我看到它的许多变化的工作,所以你应该尝试调查一点一点关于它


I am devloping a facebook app. Stragnly, the app work fine on most browsers (I tested it on FF, chrome and safari and it worked fine on all of them). However when I tested on IE8, I received this error message when trying to make an ajax call to one of the pages:

Fatal error: Uncaught Exception: 102: Requires user session thrown in
/home1/website/public_html/facebook/src/facebook.php on line 515

This is the function than contain line 515 in facebook.php:

protected function _restserver($params) {
  // generic application level parameters
  $params['api_key'] = $this->getAppId();
  $params['format'] = 'json-strings';

  $result = json_decode($this->_oauthRequest(
    $this->getApiUrl($params['method']),
    $params
  ), true);

  // results are returned, errors are thrown
  if (is_array($result) && isset($result['error_code'])) {
    throw new FacebookApiException($result);
  }
  return $result;
}

My guess is that it is something to do either with sessions or with IE8 settings but I am not sure how to fix this issue.

解决方案

Try adding this header on top of your php file:

<?php
    header('p3p: CP="NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM"');
?> 

This will make cross-domain AJAX calls work in IE

EDIT:

Actually the long correct answer is the following:

When developing an IFrame Canvas app (or any other iframe hosted in a page from a diferent domain) access to cookies (known as 3rd party cookies) are restricted under some conditions (Default IE config). Firefox, Chrome, Safari, Opera all work as expected but IE block access to this cookies. The presence of this header (Which is called a P3P Compact Privacy Policy) will make IE to accept cookies from diferent domains.

And how this makes your session code work???

Well to mantain session information in the server, the page issues a session cookie which is stored in the client. If your iframe uses session then it has to be allowed by the browser to store the cookie.

Falling to store the cookie means the session will get lost and your session-based code will fail like you have posted.

Hope this helps.

PS: BTW I have no idea what all the strange acronyms in the p3p header means. I have seen many variations of it working so you should try to investigate a little bit more about it

这篇关于Facebook应用程序适用于所有浏览器,但不是IE8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆