Our FB App page is being loaded multiple times on IE 6 and 7, with the &fb_xd_fragment parameter appended. This is only happen when the FBInit method is called.
I saw a lot of complains about this issue, but I couldn't understand how to eliminate the multiple calls, or why it only happen in IE.
I've tried the 'solution' proposed in here but it didn't help - the page is being loaded several times.
I will appreciate any info on the subject.
Related
I love React, it has quickly become my favorite development tool. It is a fantastic library that creates the kind of flexibility I've always dreamed about.
That said, I'm having a very hard time getting Facebook login to work with React in production.
I have tried all of the following methods. In all three cases, I implemented the examples exactly as shown in the code using the simplest possible technique:
https://github.com/seeden/react-facebook
https://github.com/keppelen/react-facebook-login
http://jslancer.com/blog/2017/11/27/facebook-google-login-react/
Everything works great in development. :)
When I create the production build using create-react-app and push it live, it breaks and reports: Error: Facebook is not initialized or Uncaught TypeError: Cannot read property 'login' of undefined where undefined is FB.
Basically it seems like the Facebook javascript SDK is not loaded or initialized.
The first two links above are for existing component libraries, but the third is a custom implementation that places the Facebook initialization code in the index.html file and creates an event listener. The results are the same in all three examples.
It is as if something about the create-react-app compression method is obfuscating the variables to the point that Facebook can no longer work, or at least is not available to the react code. This includes all calls to window.FB as recommended in many tutorials.
I've been working at this for a couple of weeks now (off and on) and am now turning to the hive mind. Anyone have any ideas on how to get Facebook to actually work with Facebook's own code library (React)? It seems so painfully odd that it causes this much trouble and I have been unable to find a clear solution that works in production.
Most of the debugging steps are already mentioned in the comments section.
Here are the steps laid down:
1) Check the network tab in your browser's console and see if the request to load FB's SDK is successful or not
2) Most common culprit is some extension like Ad-Blocker blocking such async requests which loads JS on your web page. Disable it or try it incognito mode
3) Other common mistake I have seen is forgetting to use the FB.init({ // config }); function - which is the actual call which initializes the fb sdk and makes available the FB variable globally.
Generally my application response times are good and pages load quickly. However login, using Zend_Auth with mysql db, takes an age compared to other tasks. I'm wondering has anyone else encountered this?
If not can anyone suggest a good way to debug and find the cause of the slow down?
FYI most pages are rendered under a second after their link is clicked whereas login takes around 7 seconds.
First you need to figure out what is causing slowdown. Add this to your application.ini:
resources.db.setDefaultTableAdapter = 1
resources.db.params.profiler.enabled = true
resources.db.params.profiler.class = Zend_Db_Profiler_Firebug
Then use Firefox+Firebug+FirePHP to see (in Firebug Console) list of all queries. Maybe one of them is really slow? Or maybe you make a lot of them?
Other thing to do is to check Net tab (Firebug) with 'keep changes' turned on to see if you don't make too many redirects or maybe some JS files are slowing down downloading page?
Last step is to install XDebug and run your login with XDEBUG_PROFILE parameter and then use KCacheGrind tool to see what is happening during login and what takes most time.
(Check manual)
I guess it's time for ask help.
My zend 2 action called twice. But it does not get called twice if it is internet Explorer.Tried to disable firebug but still the same.I saw other threads but did not find any suitable solution for me.
Update:
The other thread I have seen that seems to be useful is
Zend 2 Action get called twice
But the problem does not go away.
Help me Stack Over-flow-nobi, you're my only hope.
I see lots of posts and questions about the 'Unexpected Token ILLEGAL' issue in chrome, but haven't found a solution for my own variety of the problem.
I'm building a Facebook tab that needs to be served https (Facebook policy). It's a page built in WordPress and I'm using the WordPress HTTPS plugin to force my particular page to render with HTTPS.
When I test with regular old HTTP, everything is fine (except for the "unsecure content" warnings, but that's another issue).
When I test with HTTPS, when the page loads the first time, it's okay, but if I hit REFRESH, then I get the ILLEGAL error. It's inconsistent - sometimes it balks on a different file, but something bad happens almost every time.
The page is at http://www.facebook.com/pages/TbkCreative-Leavens-VW-Beta/178151292291863?sk=app_363900450303117
screen shot of error on Chrome console http://tbkcreative.com/sandbox/leavens/files/2012/01/unexpected_token.png
Any insight? I'm banging my head against the wall on this one.
Thanks
Trevor
File this one under the red herrings and wild goose chases.
I'm using a plugin called GD Star Rating on this app. It includes a dynamic CSS file. It was being loaded in with:
<link rel='stylesheet' id='gdsr_style_main-css' href='https://tbkcreative.com/sandbox/leavens/wp-content/plugins/gd-star-rating/css/gdsr.css.php?t=1327595625&s=a10i10m20k20c05r05%23121620243046%23121620243240%23s1pchristmas%23s1pcrystal%23s1pdarkness%23s1poxygen%23s1goxygen_gif%23s1pplain%23s1ppumpkin%23s1psoft%23s1pstarrating%23s1pstarscape%23t1pclassical%23t1pstarrating%23t1gstarrating_gif%23lsgflower&o=off&ver=1.9.10' type='text/css' media='all' />
If I got rid of all of those query arguments, the problem went away. Ditto for if I just got rid of the file altogether. I didn't dig deeper to figure out exactly what was causing the issue, as I was just relieved to figure it out.
I don't understand why this file was causing javascript files down the pipe to be loaded incorrectly. I don't understand why it only happened in Chrome, accessing the page with HTTPS and when I hit refresh. Weird.
But fixed.
Im hours and hours finding why one of my ZEND plugin sometimes running twice (depends on URL)
Note that my plugin has preDispatch and postDispatch methods and when I debugging the code it works like this:
MY_Plugin:preDispatch (echo $_SESSION['DBG'] has value)
MY_Plugin:postDispatch (unset($_SESSION['DBG']))
and then again
MY_Plugin:preDispatch (echo $_SESSION['DBG'] not exist)
MY_Plugin:postDispatch
This is part of bootstrap code
$_SESSION['DBG'] = 'value';
$MYrouter = new MY_Router_MyRouter();
$frontController->setRouter($MYrouter);
$frontController->registerPlugin(new MY_Plugin());
Do you have any suggestion how this could occur or how can I simulate this.
Thanks for any suggestion
Cervenak
Thanks guys for lot of valuable hints.
Now watch my story :)
First I had turned off showing exceptions (parameter False). So I switch them ON to see exception notification.
$frontController->throwExceptions(true);
Than I saw that I dont have uploaded controller and view files. After uploading them ZEND started to work corectly.
Good to know to have this direction set ON during debugging. You could probably save hours.
The dispatcher loop most likely running twice (the controller is dispatched twice). Possible causes:
using action view helper
calling _forward
redirector action helper
manually calling dispatch()
dispatch loop aborted and started again (eg. resetting request params)
Also, take a look at this ZF flow diagram (hotlinked from php-professionals.com)
Another reason could be an missing favicon.ico :-)
If the Apache cant find it, it fires a second request.