简体   繁体   English

使用Facebook共享的IE出错 - 并且没有关闭窗口

[英]Error in IE with Facebook share - and doesn't close window

I'm using some barely modified sample code from Facebook to post to a user's feed: 我正在使用来自Facebook的一些几乎未修改的示例代码发布到用户的订阅源:

<a class="facebook popup" 
href="" 
title="Post to Facebook"
onclick="FB.ui(
    {
        method: 'feed',
        name: 'Feedback from Customer in x',
        link: 'http://localhost/User/Feedback.aspx',
        picture: 'http://localhost/Images/Picture.jpg',
        caption: 'Caption goes here.',
        description: 'Description goes here.'
    }
);
return false;">
<img alt="Post to Facebook" src="../Images/feedback-fb.png"/>

But I'm seeing a couple of problems in IE(9). 但我在IE中看到了几个问题(9)。

  1. Script error: SCRIPT70: Permission denied all.js?_=1316190103502, line 22 character 4250. 脚本错误: SCRIPT70: Permission denied all.js?_=1316190103502, line 22 character 4250.
  2. When the user presses cancel or post, the dialog doesn't close. 当用户按下取消或发布时,对话框不会关闭。

If it makes any difference, most browsers use the 'dialog' display type where IE in this case is using 'popup' for some reason. 如果它有任何区别,大多数浏览器使用'对话'显示类型,其中IE在这种情况下由于某种原因使用'弹出'。 If I force it to use display: 'popup' then (at least) Chrome seems to work fine. 如果我强制它使用display:'popup'然后(至少)Chrome似乎工作正常。 Any help would be appreciated! 任何帮助,将不胜感激!

For this particular problem, I was able to have the error go away in IE9 by configuring my server to return the header (this is in nginx syntax): 对于这个特殊的问题,我可以通过配置我的服务器返回标头(这是在nginx语法中)在IE9中消除错误:

  add_header P3P 'CP="HONK"';

You can do the same for other servers like apache, etc., or, alternatively return it from a server script. 您可以对其他服务器(如apache等)执行相同操作,或者从服务器脚本返回它。 I didn't do this but I believe the syntax in php is: 我没有这样做,但我相信php中的语法是:

header('P3P: CP=HONK');

This is an overt shim as there's a lot more to " properly " implementing P3P. 这是一个公开的垫片,因为“ 正确 ”实施P3P还有很多。 However, we just wanted to see what minimal effort was required to make this error go away and the above worked. 但是,我们只是想看看使这个错误消失所需的最小努力以及上述工作。

I had two problems. 我有两个问题。 First was an IE bug in FB which has a workaround (which is the one described here). 首先是FB中的IE错误,它有一个解决方法(这里描述的那个)。 Bug: 20168 . 错误: 20168 Workaround: 解决方法:

FB.UIServer.setLoadedNode = function (a, b) { FB.UIServer._loadedNodes[a.id] = b; }; // IE hack to correct FB bug 20168

Found from this question here on SO. 这个问题找到SO。

But I also had trouble with my FB app domain - I had to configure the FB app to point to the specific subdomain I was using (x.domainname.com) otherwise in IE when I called FB.login I got a permission denied error and another blank screen. 但是我的FB应用程序域也遇到了问题 - 我必须将FB应用程序配置为指向我正在使用的特定子域(x.domainname.com),否则在我调用FB.login我得到了一个权限被拒绝错误另一个空白屏幕。

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

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