Could not retrieve data from URL from facebook with like button - facebook

I was using like button in my website with properly configured app. But right after I copied this code for Google Analytics:
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-40129864-4', 'klejner.pl');
ga('send', 'pageview');
</script>
Facebook started to having problems with retriving data from my website (like thumbnails). After linking my site inside facebook wall I can see only url, nothing more.
Here is info from Open Graph Object Debugger which shows me that facebook is scraping my website but has problem with collectiong data:
https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fklejner.pl%2Fobrazek%2FdUFNwX%2Fwiezyczka-v20
I have already tried to solve this problem with:
adding information about platfrom (website) in my app settings
adding my site URL to Valid OAuth redirect URIs (in Advanced tab)
deleting old and creating new app
deleting Google Analitycs code
No success yet.

Ok, solved.
It was not the Google Analytics code. The problem was with encoding. In mysteroius way my Notepad++ changed previous used UTF-8 encoding without BOM into normal UTF-8. When i changed it back, my script started to work.
And thanks Control Alt Design, i have to change that.

Related

Inserting Facebook plugin on mediawiki

I am trying to get the Facebook plugin working on my wiki. Using the guidelines provided by Facebook I copied the Java Script SDK in MediaWiki:Common.js, which should run it for all users.
Now I am trying to enter the simple HTML code also generated by Facebook :
<div id="Facebook" class="fb-page" data-href="(my FB page)" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true" data-show-posts="false"></div>
'My FB page' is of course replaced by the actual URL.
I tried two ways of entering the code.
Making a Template:Facebook page and linking to it like {{Facebook}} on the actual page
Even though this is not recommended forcing the html by adding the parameter $wgRawHtml = true; and entering the code in the ... tags.
None of this ways resulted in the Facebook plugin appearing on my wiki.

Links in fb canvas apps not working in IE

I created a canvas facebook app. The app itself was made in html and consisted of multiple different pages, the first page linking to the next, and so on... (links were assembled as simple html a tags with target="_self")
Everything seemed to be working fine in FF, Safari, Chrome, but not when we were testing in IE. It seems that redirecting within an iframe works different in IE, and it showed in the url of the browser:
When testing in FF,..., the url of the startpage would be apps.facebook.com/our-namespace, and after linking to the next page, this url in the browser would always remain that same apps.facebook.com/our-namespace.
When testing in IE, the url of the startpage would also be apps.facebook.com/our-namespace, but as soon as you hit one of the links, the url in the browser would change to apps.facebook.com/our-namespage/the-page-we-re-linking-to.php, not taking the target="_self" into account. When clicking on a comparable link again, the app would redirect to the start screen...
I spent hours trying to find an answer, I saw that changin IE's security settings would make it work:
in IE: go to Tools --> Internet Options --> Security --> Internet Zone --> Custom Level --> Miscellaneous --> Launch programs and files in an IFRAME. and make sure it is set to enabled
But this is not an acceptable solution as IE is configure different by default.
I found the solution was (in php) to add the following line to your code:
<?
header("p3p: CP=\"ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV\"");
?>
Problem solved! This should be in the facebook developer docs!!

Facebook “Like Box” and JQuery

I'm attempting to add a FB "Like Box" to a website I'm developing. Not too familiar with Facebook apps, but so far I've gone the non-IFRAME route, using the FB SDK script include.
I'm fairly certain I've got almost everything setup correctly. In fact, I see the widget appear when I visit the page UNCACHED (i.e. in FF, I hit CTRL+SHIFT+R to reload all content to avoid loading from cache). Once I revisit the site, or move around within the site by clicking links, the content does not reappear.
I'm wondering if it's an issue with a) the channel.php file, or b) the apps interaction with my use of JQuery. The channel.php file is verbain what is provided by Facebook (using PHP's caching mechanism).
Here's the site currently: http://www.morningfatty.com/demo - It might be easier to list this rather than post several code snippets.
I went to your website and didn't see the like box. I checked the HTML code and it all appeared fine. The div looked like <div data-header="false" data-stream="false" data-border-color="#40ADAD" data-show-faces="true" data-colorscheme="light" data-width="192" data-href="http://www.facebook.com/morningfatty" class="fb-like-box"></div>
I went to https://developers.facebook.com/docs/reference/plugins/like-box/ and tried your link http://www.facebook.com/morningfatty and lo-and-behold the like box didn't display there.
I tried going directly to http://www.facebook.com/morningfatty and it redirected me to http://www.facebook.com/MorningFatty. I noticed the change of case in the name. So I went back and tried http://www.facebook.com/MorningFatty in the like-box and it worked!!.
I believe that you page will work once you update the casing on the url. :)

Facebook iFrame application -- IE7 not allowing cookies

I know this topic has been covered extensively, but I am totally stuck and in need of some direction and new opinions. I have a Facebook iFrame application that works perfectly in IE6,8, Safari, Chrome, FF, etc. Only IE7 gives me grief.
I have created a P3P policy file, and its associated XML file. The policy fully validates with the P3P policy validator.
As soon as the iFrame loads from within Facebook, the red eye icon appears and when I click it, it reports that cookies from the iFrame's domain are blocked. I have confirmed that the default 'medium' privacy setting is set on IE7. Interestingly I've found that by removing Google Analytics, the page will load initially without blocking the cookies, but as soon as the page reloads, or the user logs in, cookies are then blocked again even though the P3P header is sent immediately from every page. All assets are sent via S3, so there shouldn't be any issues there.
FYI, here's my P3P file; I've tried absolute paths, relative paths, switching order of CP and policyref, and separated the two into separate header calls with no luck.
header('P3P: CP="NON DSP TAIa PSAa PSDa OUR IND UNI", policyref="/w3c/p3p.xml"');
I have confirmed that the P3P Header is being sent and received by the browser. I have added a META p3p tag to the HTML page. I have removed all redirects. Still the issue persists. I've spent so much time looking into this, and I am now out of ideas. Any thoughts or ideas about how to approach this from a fresh perspective would be greatly appreciated. I'm using PHP 5.3.5 over NGINX. No framework being used...
I had the same problem. Facebook iframe app worked great in all browsers except IE7. When you first went to the app it loaded fine. But then when you clicked a link it would load the page okay but then after a second or so would refresh and redirect the browser. In the end you just got a blank page. I also had the red eye icon blocking the cookies.
The culprit turned out to be the javascript code which loads the facebook javascript lib:
FB.init({
appId : '<?=FACEBOOK_APP_ID?>',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
To fix the problem I changed status : true, to status : false. Now when clicking links the page loads and doesn't refresh.
So whats really going on here I am not sure but I have a guess...The redirect was being caused by the FB javavascript checking the login status and for some reason thinking the user was logged out and so redirecting to a login page. The server side login script I guess would then see that you had indeed logged in and redirect you back to the app. So on and so on.
So the problem of IE7 not setting the cookies set inside the iframe still exists, the evil eye remains. But as long as the links inside your iframe reference the parent window target="_top" pointing at the facebook canvas page it seems you don't need the cookie anyway. The PHP SDK looks for the session in a number of places starting with $_REQUEST. I am guessing that when facebook loads the iframe it includes the session param in the query string. So even though the cookies don't work in IE7 through the iframe your server scripts will still get them from the query param.
Hope that makes some sort of sense, I don't totally get it but it fixed my app.
i don't know but maybe this will help, it worked like a charm on my app.
header('P3P: CP="CAO PSA OUR"');
ob_start();
session_start();

Facebook | redirect error

I have facebook connect button on a page of my site and I want user to redirect to a page after a successful login: here's the code snippet:
</script>
<fb:login-button onlogin="facebook_onlogin();">
</fb:login-button> <script type="text/javascript">
FB.init("API_KEY", "http://myip/facebookapp/xd_reciver.html/");
function facebook_onlogin() {
window.location="http://myip/facebookapp/mypage/"
}
</script>
But when I logged in it redirects to the page INSIDE the pop-up, how can I redirect to the page out side of the popup..
In my experience, this is generally caused by not having the cross-domain receiver file set up properly.
Assuming you copied the cross-domain receiver file that Facebook provides, then in your code snippet above, it looks like you misspelled "receiver" in xd_receiver.html. Double-check that it is a valid URL by copying and pasting it into your browser and making sure it can be loaded... my guess is you'll have to fix the spelling and remove the trailing slash, ie. http://myip/facebookapp/xd_receiver.html. Double-check the API key while you're at it, Facebook Connect can be quite frustrating to set up sometimes.
Are you using latest connect javascript sdk by facebook or the oldest one ?
checkout the latest javascript sdk by facebook http://developers.facebook.com/docs/reference/javascript/
Here you'll see nice working example.