Search code examples
facebookfacebook-graph-apiflashfacebook-wall

Unable to embed Flash (SWF file) to wall post via Facebook Graph API


I'm trying to embed the SWF file to the wall post but it works with Youtube URL but not for my own URL. When it doesn't work it will not even show the picture in the post. See below for the code.

This one is work:

$result = $facebook->api('/' . $postTo . '/feed' , 'post' , array(
            "name" => APP_NAME,
            "message" => mysql_real_escape_string($title2),
            "picture" => "http://www.mydomain.com/pinklogo.jpg", 
            "link" => fb_root(),
            "caption" => $title,
            "description" => $des,
            "source" => 'http://www.youtube.com/v/qAsx_PkkMu8'
        ));

This one is not work:

$result = $facebook->api('/' . $postTo . '/feed' , 'post' , array(
            "name" => APP_NAME,
            "message" => mysql_real_escape_string($title2),
            "picture" => "http://www.mydomain.com/pinklogo.jpg", 
            "link" => fb_root(),
            "caption" => $title,
            "description" => $des,
            "source" => 'http://www.mydomain.com/qAsx_PkkMu8.swf'
        ));

Is there any approval request that I need to do before Facebook allow to publish SWF from my domain?

Thanks.


Solution

  • Are you getting a security exception thrown? You may need a cross domain policy file that grants cross domain script access. The swf is hosted on a page on facebook.com, but is trying to load resources from mydomain.com. Flash player will block it unless your domain has specifically allowed it.

    This person had a similar problem. This question has a lot of examples of what your file could look like.

    Please be aware that if you put a liberal cross domain policy file on your server (like allowing '*') you could make users of your website more vulnerable to cross site scripting attacks.

    For what and why from Adobe see here, here and here.