简体   繁体   中英

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:

<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).

  1. Script error: 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. If I force it to use display: 'popup' then (at least) Chrome seems to work fine. 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):

  add_header P3P 'CP="HONK"';

You can do the same for other servers like apache, etc., or, alternatively return it from a server script. I didn't do this but I believe the syntax in php is:

header('P3P: CP=HONK');

This is an overt shim as there's a lot more to " properly " implementing 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). Bug: 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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