kennylerma / facebook-actionscript-api

Automatically exported from code.google.com/p/facebook-actionscript-api
0 stars 0 forks source link

Facebook.init never calls handler in Firefox #289

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use firefox 3.5, 3.6, or 4.0 

2. Have the flash client execute Execute Facebook.init(_appID, 
handleFacebookLogin); after ensuring the FBJS library is functioning properly.

What is the expected output? What do you see instead?

  -handleFacebookLogin should be called and never is

What version of the product are you using? On what operating system?

Firefox 3.4 3.5 3.6 

Please provide any additional information below.

I'm having a weird symptom with the new AS3 1.6 Graph SDK - on firefox - when i 
issue Facebook.int(blah) - it doesn't recieve a callback event, let alone a 
response or fail object. However, when i install firebug it works fine. I 
uninstall firebug and it goes back to not receiving the event.

It DOES work on IE / Chrome / Safari

It feels like a similar issue to 
http://code.google.com/p/facebook-actionscript-api/issues/detail?id=165

HTML:

<script type="text/javascript" 
src="http://**REDACTED**.com:8000/flash/js/swfobject/src/swfobject.js"></script>
        <script type="text/javascript">
            //define debug swf
            var swfName = 'Game.swf';
            var isDebug = regUrlParamaters( 'debug' );
            if(isDebug) {
                swfName = 'Game_Debug.swf';
            }

            var flashvars = {};
            var params = {};
            var attributes = {};
            flashvars.fb_app_id = "**REDACTED**";
            flashvars.id = "flashContent";
            flashvars.name = "flashContent";
            flashvars.log_level = "net";
            params.swliveconnect = "true";
            params.allowfullscreen = "true";
            params.allowscriptaccess = "always";
            params.allownetworking = "all";
            params.wmode = "transparent";
            attributes.id = "flashContent";
            attributes.name = "flashContent";
            swfobject.embedSWF("http://**REDACTED**.com:8000/" + swfName + "?r=19569", "myAlternativeContent", "760", "580", "10.0.20", "/js/swfobject/expressInstall.swf", flashvars, params, attributes);
        </script>

        -------

<div id="myAlternativeContent">
    <a href="http://www.adobe.com/go/getflashplayer">
        <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
    </a>
    <p>You need to download <a href="http://www.adobe.com/go/getflashplayer">Adobe Flash Player</a> to play Idle Worship!</p>
</div>

        ------

        <script src="http://connect.facebook.net/en_US/all.js"></script>

        <script>

              FB.init({
                appId  : '142099075844632',
                status : true, // check login status
                cookie : true, // enable cookies to allow the server to access the session
                xfbml  : false  // parse XFBML
              });

        </script>

        -----

ACTIONSCRIPT CODE: 

private function tryConnect():void {
            _reconnectTimer = new Timer(3000, 5); 
            _reconnectTimer.addEventListener(TimerEvent.TIMER, doConnect);
            _reconnectTimer.addEventListener(TimerEvent.TIMER_COMPLETE, handleLoginFailure);
            _reconnectTimer.start();
            trace("GraphConnector::tryConnect - Facebook Connection Attempted to with FBSessionInfo.appID of: " + FBSessionInfo.appID + " and _appID of " + _appID);
            doConnect(null);
        }

        private function doConnect(e:TimerEvent):void {
            _logger.diag("GraphConnector::doConnect - Retry attempt" + _reconnectTimer.currentCount);
            Facebook.init(_appID, handleFacebookLogin); 
        }

        private function handleLoginFailure(e:TimerEvent):void {
            trace('never got a callback)
        }

        private function removeTimer():void {
            if(_reconnectTimer) {
                _reconnectTimer.stop();
                _reconnectTimer.removeEventListener(TimerEvent.TIMER, doConnect);
                _reconnectTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, handleLoginFailure);
                _reconnectTimer = null;             
            }
        }

        private function handleFacebookLogin(success:Object, fail:Object):void {

            handleFailureObject("GraphConnecor", fail); 

            if(success) {
                removeTimer();
                _logger.diag("GraphConnector::handleFacebookLogin - Facebook Connection Success!");
                FBSessionInfo.oAuthToken = success.accessToken;
                FBSessionInfo.sessionKey = success.sessionKey;
                FBSessionInfo.sessionSecret = success.secret;
                FBSessionInfo.userId = success.uid;

                if(connectCallback != null) {
                    connectCallback(success);   
                }
            }
        }

Original issue reported on code.google.com by symbionm...@gmail.com on 13 Apr 2011 at 8:07

GoogleCodeExporter commented 9 years ago
I've also been fighting with this issue, in my case firefox 4.0 works but 
firefox 3 is very 50/50 if it will return anything on the Facebook.init call or 
not, and that's after spending a crazy amount of time tweaking the 
html/javascript and trying a crazy amount of things. All other browsers seem 
fine.

Also the second I even think about adding a social plugin to the page it 
doesn't work at all (for firefox 3 that is).

Original comment by percy...@percypea.com on 13 Apr 2011 at 9:42

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
So because firebug seemed to "solve" the problem, i went looking for an 
alternative javascript debugger so i could take a look at what was going on. I 
stumbled upon Jash: http://billyreisinger.com/jash/

Amazingly, starting this widget as a bookmarklet also seemed to solve the 
issue. It has me wondering if this is some type of unrecoverable race condition 
between FBJS and the Flash Library. 

Original comment by symbionm...@gmail.com on 13 Apr 2011 at 11:11

GoogleCodeExporter commented 9 years ago
It sounds like a strange issue. The Facebook.init() method is meant to be 
called once to initialize the library. You do not need to call (FB.init) in 
javascript because the api already does that via FacebookJSBridge. The init 
callback lets you know if you are logged in or not, but you're supposed to call 
Facebook.login() to actually connect/login. 

Original comment by edwar...@gmail.com on 18 Apr 2011 at 9:55

GoogleCodeExporter commented 9 years ago
Is this still an issue with the latest api?

Original comment by edwar...@gmail.com on 25 Oct 2011 at 8:19

GoogleCodeExporter commented 9 years ago
I'll try and repro 

Original comment by symbionm...@gmail.com on 25 Oct 2011 at 10:51

GoogleCodeExporter commented 9 years ago
not working in 1.8.1

Original comment by n...@bissano.com on 3 Nov 2011 at 9:50

GoogleCodeExporter commented 9 years ago
I have the same problem, in Firefox (latest) and Safari.
But I am calling Facebook.init from a swf that was loaded by another swf, could 
this be the problem for me?

Original comment by marc.wei...@googlemail.com on 7 Nov 2011 at 4:23

GoogleCodeExporter commented 9 years ago
1.8.1 not working on production server but works fine on localhost. 
Facebook.init never call on all browsers.

Original comment by stesti...@gmail.com on 9 Nov 2011 at 5:13

GoogleCodeExporter commented 9 years ago
Maybe I am the only one who did not know this, but one can call login on a 
button click even though the init method did not call the callback.
I am using it like this now, logging in and sharing works fine.

Original comment by marc.wei...@googlemail.com on 9 Nov 2011 at 5:23

GoogleCodeExporter commented 9 years ago
Thank the lord that other people are reporting this issue. I've just built an 
AS3 app for a Facebook Page tab and suddenly discovered exact same issue on my 
version of Firefox. I then went back and checked the last three apps I built, 
where it was never a problem before - all of a sudden they're not working 
either.

It seems that neither Facebook.init() nor Facebook.login() calls do anything. I 
had been using SDK v1.5 to build the app, but decided to test it with the 
latest 1.8.1 build - still no dice. 

I'm getting the exact same behaviour as Comment #9 - it works fine on 
localhost, but as soon as I move it to a production server, it stops working. 

Here's what I've discovered thus far:
 - It won't work in Firefox 6, 7 or 8 on my desktop (running WinXP SP3)
 - It works pefectly fine in IE7, IE8 and Chrome
 - It also works perfectly fine on my laptop, which is Win7 Home with Firefox 6.0.2

This leads me to believe it *may* be an issue with any of the add-ons I have 
for Firefox. I'm currently running Firebug, Flashbug, AdBlock Plus and FireFTP.

** UPDATE **

I just disabled AdBlock Plus and BOOM. Facebook.init() worked immediately. I 
tested it with all my other add-ons enabled and AdBlock Plus disabled - 
Facebook.init() and Facebook.login() callbacks working as expected.

I'm going to have a play around with AdBlock Plus now to see if I can tweak any 
of the blocked items, but hopefully this will solve the issue for some of you.

Original comment by lawriema...@gmail.com on 11 Nov 2011 at 10:12

GoogleCodeExporter commented 9 years ago
Any Luck?

Original comment by sunny.ag...@gmail.com on 23 Feb 2012 at 3:12

GoogleCodeExporter commented 9 years ago
oh,my god! I find the reson. it is follow:

/*Get a reference to the embedded SWF (object/embed tag). Note that 
Chrome/Mozilla Browsers get the 'name' attribute whereas IE uses the 'id' 
attribute. This is important to note, since it relies on how you embed the SWF. 
In the examples, we embed using swfObject and we have to set the attribute 
'name' the  same as the id.*/
 so. try to  find  the html  or js  your swf embed. is the  "id" or "name" is not define!

Original comment by dddddddd...@gmail.com on 4 Mar 2013 at 9:55