Facebook Connect 使用 IE8 造成问题;有什么解决方法吗?
我一直在努力解决在 IE8 上使用 Facebook Connect 的问题,似乎已经走到了死胡同:
我们有一款 Facebook 游戏 (Canvas iFrame),在使用 IE8 时报告了问题。我们完全按照 FB.init 开发者页面上的说明进行操作,但无处可去。
我们尝试使用channelUrl修复和各种修复,如此处所述。
我们的响应标头正在发送 P3P 标头:
P3P CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
我们还测试了此集成的异步和同步版本,结果均未产生任何差异。
尽管我们付出了一切努力,但在 IE8 上,FB.getSession() 始终返回未定义的值。在报告给 Facebook,他们将其解决为不是一个错误......尽管用户在认为该问题已解决很久之后仍在该线程上不断报告该问题。
在最后的尝试中,我转向这里,从一个健全的测试 FB 应用程序开始,除了 FB.init JS 示例添加了一些控制台日志记录以显示 FB.getSession 已获得一个之外,该应用程序中不包含任何内容。 uid。
如果您正在回复此问题,请问您是否正在针对 IE8 检查此内容并查看控制台,在成功加载 FB 会话后,该控制台将写入
FB: [object Object] FB.getSession().uid: [your fb id]
http://apps.facebook.com/fb-js-issue
那里的代码是如下:
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId: 'appId',
status: true,
xfbml: true,
cookie: true,
channelUrl: "http://ourserver.com/channelUrl.htm"
});
FB.Canvas.setAutoResize();
console.log("Running FB test");
setTimeout(function() {
console.log("FB: " + FB + " FB.getSession().uid: " + FB.getSession().uid);
}, 5000);
};
(function () {
var e = document.createElement('script');
e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
所以总的来说,示例应用程序工作正常,尽管在极少数情况下甚至会出现问题。
我们的真实应用程序(使用相同的 FB.init 方法)在 IE 上始终遇到 FB.getSession 未定义问题,因此无法加载
http://apps.facebook.com/party-on
更新:我们已确定该问题对 Windows XP 或 Windows 上的 IE8 的影响更为严重Vista - Windows 7 上的 IE8 似乎问题较少(尽管不是 100%)
如何解决这个问题?
所以.. 鉴于这个问题似乎很常见并且没有明确的解决方案,缺乏一些严重的解决方案尚未公开讨论的魔法将最终解决这个问题,真正具有指导意义的是强调与 FB.connect 集成的其他可能方法,而不是他们展示的方法。
我提到这一点的原因是当您查看如何CityVille 和 FarmVille 进行了他们的 FB 集成,这与 FB 自己作为开发人员文档编写的内容相差甚远。嗯,有趣
任何新鲜的想法和不同的角度都会在这个阶段受到热烈欢迎!
I've been wrestling with problems using Facebook Connect on IE8 and i've reached a dead-end it would seem:
We have a Facebook game (Canvas iFrame) which had problems reported when using IE8. We've followed the instructions on the FB.init developer page exactly, but got nowhere.
We tried using the channelUrl fix and various kinds of fixes all as outlined here.
Our response headers are sending the P3P header:
P3P CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
We also tested async and sync versions of this integration, neither yielded any differences in outcomes.
In spite of all our efforts, on IE8, FB.getSession() always returns an undefined value. There is plenty of information I have reviewed, though disappointedly had no success, in the bug reported to Facebook which they resolved as not a bug... despite ongoing reports of the issue from users on the thread long after they considered it resolved.
In a last ditch attempt I'm turning to here, and start with a sanity of an test FB app which has nothing contained within it except the FB.init JS example added with some console logging to show that the FB.getSession has got a uid.
If you are replying to this, please can I ask that you are checking this against IE8 and are looking at the console, which on a successful load of the FB session will write
FB: [object Object] FB.getSession().uid: [your fb id]
http://apps.facebook.com/fb-js-issue
The code there is as follows:
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId: 'appId',
status: true,
xfbml: true,
cookie: true,
channelUrl: "http://ourserver.com/channelUrl.htm"
});
FB.Canvas.setAutoResize();
console.log("Running FB test");
setTimeout(function() {
console.log("FB: " + FB + " FB.getSession().uid: " + FB.getSession().uid);
}, 5000);
};
(function () {
var e = document.createElement('script');
e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
So by and large that sample app works fine, though in rare case even that has problems.
Our real apps (which use the same FB.init method) consistently suffer FB.getSession undefined problems on IE, thus fail to load
http://apps.facebook.com/party-on
UPDATE : We have determined that the problem more severely affect IE8 on Windows XP or Vista - IE8 on Windows 7 seems to be less problematic (although not 100%)
How to get past this?
So.. given that the problem seems pretty common and no fix is clear, short of some serious magic which hasn't yet been discussed publicly which will finally fix this issue, what would be really instructive would be highlighting other possible ways to integrate with FB.connect other than the one they show
The reason I mention this is when you look at how CityVille and FarmVille do their FB integration it's nothing remotely close to what FB themselves author as developer docs.. Hmm, interesting
Any fresh ideas and different angles would be massively welcomed at this stage!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
只是一个随机问题,您真的在 IE 8 模式下使用 IE 8 吗?请小心,因为有时 IE 8 会切换到兼容模式 (IE 7),然后您将面临一系列全新的问题。您页面上的此代码强制 IE 以最新版本呈现。它必须是第一个元标记。
http://msdn.microsoft.com/en-我们/library/cc288325(v=vs.85).aspx
Just a random question, are you really using IE 8 in IE 8 mode? Be careful, because sometimes IE 8 flips to compatibility mode (IE 7) and then you're dealing with a whole new set of issues. This code on your page forces IE to render in the latest version. It needs to be the very first meta tag.
http://msdn.microsoft.com/en-us/library/cc288325(v=vs.85).aspx
我解决了类似的问题,在 body 标记后添加异步加载
I solved a similar problem adding async load after body tag
尝试删除整个应用中的所有
console.log()
调用。try removing all
console.log()
calls in your entire app.我刚刚花了很长时间试图弄清楚为什么我的 Facebook 应用程序无法在 IE8 中运行,但在其他浏览器中运行良好。症状是 FB.init 似乎被调用正常,但在随后调用 FB.getLoginStatus(callback) 时,回调在 IE8 (WinXP) 中没有被调用。
我最终通过从 IE8 中卸载“Google Chrome Frame”修复了该问题。在 IE 附加管理器中禁用它是不够的,我必须通过控制面板完全卸载它。它的安装是为了允许在 IE8 中查看 GMail,而我的愤世嫉俗者认为 Google 可能不会太介意这是否会破坏 FB。该插件似乎还阻止 IE8 的 javascript 调试器加载 FB 页面,这使得弄清楚发生了什么变得更加困难......
无论如何,我想我会在这里分享信息,以防其他人遇到类似的问题。
Have just spent ages trying to work out why my Facebook app was not working in IE8 but was fine in other browsers. The symptoms were that FB.init seemed to be called ok, but in the subsequent call to FB.getLoginStatus(callback) the callback just wasn't being called in IE8 (WinXP).
I eventually fixed it by uninstalling 'Google Chrome Frame' from IE8. Disabling it in the IE add-on manager was not enough, I had to uninstall it completely through control panel. It had been installed to allow GMail to be viewed in IE8, and the cynic in me thinks that Google probably don't mind too much if that breaks FB. The plugin also seemed to prevent IE8's javascript debugger from loading FB pages, which made it extra hard to work out what was going on...
Anyway, thought I'd share the info here in case anyone else has a similar problem.