views:

1391

answers:

3

am pulling my hair over this :( spent 10 hrs but nothing came out

I read this thread http://forum.developers.facebook.com/viewtopic.php?pid=198128

but it didn't help much.

I'm running a local dev App Engine server ( localhost:8080 )
iframe app

so I have a couple of problems.
1) on safari 4.0.4, the publish story dialog comes up nicely with all images/data/action_links. upon posting a story (or skipping), the dialog goes blank and wouldn't close.

2) I tested the same code on firefox 3.5.8, the dialog comes up with all images/data/action_links, but then the whole thing freezes.

Clicking anywhere on the dialog doesn't help at all. If i'm patient enough and click "publish", I have to wait for abt 10 seconds before the dialog says "story is published". then it freezes. (clicking on skip doesn't make a difference).

btw, there is no "button clicking effect" : ie: the buttons don't look like they "sink down" upon clicking.

I checked the firefox memory using the command "top" on the terminal, it all seems okay, no spike in CPU processes ( i could open other firefox tabs and work on them)

My futile attempts at solving the problems...

1) so i thought, hmm could this be because of local dev (localhost) problem? I uploaded the code to the production server, the same thing happens.

2) I tried an older firefox (3.1) and the same problem persisted ( the freezing )

3) I noticed that i kind of used 2 different FB features ( Connect and XFBML). The Connect Feature I used in the PostStory function. The XFBML feature I used before the tag.

So I thought, hmm ... I tried replacing the FB_RequireFeatures["Connect"] feature with FB_RequireFeatures["XFBML"]. nothing changed. I still can't close the story dialog.

4) Is there a possibility that I didn't connect to xd_receiver.htm properly?

my xd_receiver.htm is stored in my folder /media/fbconnect

in my app.yaml

handler:
- url: /fbconnect
  static_dir: media/fbconnect

so i thought a connection has to be established with xd_receiver.htm. any way I can test that?

here're all the codes:

<script type="text/javascript">

        //post story function
        function PostStory() {
            //init facebook
            FB_RequireFeatures(["Connect"], function() {
            FB.Facebook.init('my_app_key', "/fbconnect/xd_receiver.htm");

            FB.ensureInit(function() {

                var message = 'the message';
                var attachment = {
                    'name': 'a simple app to send gifts',
                    'href': 'http://apps.facebook.com/my_app_name', 'caption': '{*actor*} sent u something',
                    'description': 'some description',
                    "media": [{ "type": "image", "src": "http://bit.ly/105QYr", "href": "http://bit.ly/105QYr"}]
                };
                //action links can only be seen AFTER the feed is published
                var action_links = [{ 'text': 'Send him/her a gift back!', 'href': 'http://somelink.com'}];
                FB.Connect.streamPublish(message, attachment, action_links, null, "Share the gift with your friends", callback, false, null);
            });
        });

        function callback(post_id, exception) {
            //alert('Wall Post Complete');
        }

}

</script>

just before the end of the /body tag, i have this:

<script type="text/javascript">

function callFBInit() { FB_RequireFeatures( ["XFBML"], function(){ FB.Facebook.init("my_app_key", "/fbconnect/xd_receiver.htm"); } ); } callFBInit();

btw, my xd_receiver.htm contains:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  <html xmlns=� http://www.w3.org/1999/xhtml�  >
    <head>
      <title>cross-domain receiver page</title>
     </head>
    <body>
      <script src=�http://static.ak.facebook.com/js/api_lib/v0.4/xdcommreceiver.debug.js�  type=� text/javascript� ></script>
    </body>
  </html>

hope you guys can help out. thx

A: 

I have the exact same problem. Technically, the streamPublish works, but the facebook window just sux. I use 3 environments to test it, but with different behaviours:

  1. Debian Linux with IceWeasel (basically Firefox). This is my development environment (with Haxe for the flash part). Once my facebook-flash-application pops-up the facebook window (with Java-Script FB.Connect.streamPublish), if I click "publish" or "skip" (to cancel), the facebook window goes completely white, leaving me with a white rectangle in front of the flash area. Also note there is not title bar in the facebook window at any time. The flash app still runs in the background, but with the white rectangle, I cannot click anywhere through. Restart...

  2. Windows XP with IE 8.0. Almost the same behaviour. The only difference is if I click the flash area beside, it gets the focus and the FB window disappears, but I know it is still open internally since I cannot pop it up again.

  3. Windows XP with Firefox. Now this is pretty different (please note that I did not confuse the OS and browsers names here). In fact, this almost works: the title bar is there with the 'x' up-right to close it, and it is ok. But if I click "publish" or "skip", the window won't close. Still, it gets completely white, except the title bar so I can still close the facebook window afterward and make it appear again without restart.

I don't think those infos will help, but hey, better than nothing. This is getting on my nerves since months, and now my boss is upset too. Facebook crap!

A: 

Ok, I managed to make it work by just omitting the channel path parameter in the FB.Facebook.init() call (the one with xd_receiver.htm). Sorry fooyee, I've seen somewhere else that you already know this, but I though I should comment here for others reaching this page.

It works well the 3 environments I told before. Now the big question is: why the hell is this not working with the channel path. I must admit I did not figure out what exactly is that xd_receiver.htm file used for, but it seems you don't need it in some cases... just commented it in my code in case I have some problems later... no doubt the window not closing problem is tied to that damn file. This issue makes me crazy, I don't like weird things like that which are not really resolved.

@tek512 thanks for posting this - having the same issues with our own app! Let's see if this works! :)
pageman
+1  A: 

hi thought I might answer my own question

I solved my problem

the reason the streamPublish dialog looked like it "freezed" seemed to be the z-index ( a CSS problem!)

I previously had a background image on my app which had a z-index of -10 ( my logic being that it should be as far back as possible).

I changed it to -1, and voila, the facebook dialog works on Safari and Firefox (all new versions)

Didn't test it with IE though, but since IE's not a huge market anymore i thought I shouldn't waste much time thinking about it [http://www.w3schools.com/browsers/browsers_stats.asp][1]

how did I come to the conclusion that I should tweak z-index? I backtraced all my steps and reduced it to a very simple iframe app with only html files. took time, but it helped!

fooyee
w00t! finally! I actually got here from the facebook developers forum hahaha let's see if this works! :)
pageman