Graph API not working in older IEs - facebook

I can't seem to get the Facebook Graph API to work in IE7, IE8, and Opera while it is working fine in FF3.6, FF8, IE9, and Chrome.
I am following the Client-side Flow from the Facebook authentication docs.
I have a Facebook Connect link and when the user clicks on it the page is directed to:
https://www.facebook.com/dialog/client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&response_type=token
The user logs in and authorizes the app if needed.
The redirect_uri page gets the access_token back just fine. I then try to do an ajax get for https://graph.facebook.com/me to just return the public data (I need name and id).
The request does not succeed.
Doing some research and finding this stackoverflow post I tried changing the ajax response type to 'text/javascript' (also tried several others). Same issues occurs.
Removing ajax from the equation I try to hit the API directly with the browser (not logged into Facebook and without an access_token) like this example from Facebook Graph API Reference page.
https://graph.facebook.com/btaylor
I can view it fine in FF. I can download and then view it fine with IE9. I get this error in IE8:
Unable to download btaylor/ from graph.facebook.com.
Unable to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.
While searching for answers I found this stackoverflow post, and sure enough Facebook's Graph API Explorer does not work in IE8.
I can't find much else on this topic which seems to say I am doing something horribly wrong. Or have developers given up on IE < 9?

A straight up GET request doesn't work in IE 8 because IE 8 can't understand the JSON format that the data is coming back in and so it crashes. For the AJAX response, you should set the AJAX reponse to application/json, not text/javascript. Is there a reason you can't just use the Facebook JS SDK? For example:
FB.init({ // options });
FB.api('/me', function(response)
{
// do stuff
});
I'm not actually sure why the Graph API explorer isn't working in IE 8, but for me, the explorer throws Javascript errors but doesn't crash the browser, while loading a Graph response via a GET results in a browser crash.

I think this is most likely just a typo on your part for the question, but the correct Facebook authorization URL is:
https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&response_type=token
Other than that, I really can't see anything else that you are doing wrong. Looks like IE8 is on its way out.

Related

Facebook graph-api and js-sdk issue with internet explorer 9-11

I'm having some issue in making social feeds work under ie9.
in this page http://www.axo.com/us/news/ there are the standard Facebook and twitter feeds widget and in ie9 are both not working.
At this other page: http://www.axo.com/us/fbfeed I'm developing a custom Facebook feed following this tutorial http://tutorialzine.com/2011/03/custom-facebook-wall-jquery-graph and I get a white page under ie9
this jQuery plugin use the direct call to 'https://graph.facebook.com/pageId/posts/?access_token=XXXXXXX&callback=?&date_format=U&limit=15
I've read some post that sudgest to use the javascript SDK instead of calling graph.facebook.com. I've made a try
jQuery.getScript('//connect.facebook.net/en_UK/all.js', function(){
FB.init({
appId: 'xxxxxx',
});
var pageAccessToken = 'xxxxxx';
FB.api('/axoracing/feed', {
access_token : pageAccessToken
}, function(response) {
alert("FB.api response")
});
});
but under ie9 the alert doesn't show... so I imagine the call to /axoracing/feed is not getting an answer.
even more strange: if I try to console.log() something it doesn't work in any browser (firefox, safari, chrome, ie, ...). It is really odd and it will be a mess to use the responded object if I can't log it!
I'll really appreciate any help.
Thanks
Daniele
IMPORTANT UPDATE:
For debug purpose I made a test page that call the graph api, the sdk api and the Instagram api. Instagram and graph.facebook calls work in the same way so I inserted the instagram call to check if the issue is in the capability of IE to understand the responded json (I've read this in some answare here in stackoverflow) or if it is an issue only related to facebook.
http://www.axo.com/prova.html
If I look at this page with chorme, firefox, safari and even ie7 it works fine. If I load the page with ie9 or ie11 I get only the instagram feed... no response at all from facebook!
I haven't tested ie8 or ie10 yet.
Do you have any idea? I can't believe it is a facebook incompatibility with ie... I'm sure I'm making something in the wrong way, but what?
Thank for the help
Daniele

Bad HTTP Response code; Facebook likes don't post to facebook

I've created post-specific like buttons on my wordpress website. They appear to work on my site and record likers etc, but nothing posts to facebook. I've tried several wordpress plugins. and all gave the same result. Twitter is working just fine. Upon debugging in the facebook open graph, I get "Bad Response Code URL returned a bad HTTP response code." (more info in the debug link below). What am I missing? Thanks in advance!
The posts can be viewed at http://www.nebulusentertainment.com/news.
You can check out my attempt at debugging here:
https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.nebulusentertainment.com%2Fjust-around-the-corner
Despite the page URL loading in the browser, they are loading with a status code of 500 - Internal Server Error; which Facebook will reject. Since you are using PHP, the fastest solution may be to turn error reporting on, and display errors on. Or take a look at your logs to see what's causing the 500 error.
You can see that your page quits outputting code are about line 328, which looks like it may be an error in the wordpress theme files somewhere (maybe single.php?).
Hope this helps.
The other reason would be, Facebook cannot access your webpage. probably because of your DNS entries or your server is behind a firewall for example your company LAN. Solution: Fix your DNS or Firewall blockages and make sure public social medias like Facebook has access to your sites.
I had the same issue, but after I disabled my cache plugin "W3 Total Cache" everything worked fine .

(#100) link URL is not properly formatted when posting to a facebook page

I am trying to post a URL to a facebook page. using PHP SDK.
I am able to post successfully from my localhost. But on the live server, I get the result "Sorry, something went wrong".
when running the code from live server, I have no problem obtaining access_token to post to the page.
Only the posting will not work.
I tried to post the link manually using the graph api explorer. and found that
I am ABLE to post a message successfully via the graph api explorer.
I am NOT able to post a URL via the graph api explorer. I get the error
"(#100) link URL is not properly formatted"
I do encode the link that i am trying to post. and they are valid, existing links.
I even tried using http%3A%2F%2Fgoogle.com , and it would return the same error.
Some Other information
The code is executed from mydomainname.com/folder/
I have added the domain name to "App Domains" field.
Sandbox Mode is On.
When I tested from my local, I was able to post 25 links to the
page.[after which it was giving errors]. When things were not
working at the live server, I came back to locahost to again test
with 25 links and more and found things to be working fine from
localhost. I wonder if I hit some limit or my application has been
black listed.
Anyone has got any ideas?
Thanks
UPDATE
I took the URL that was used by the live server (to post link to the facebook page) , and used fiddler to post it from my local machine. and it worked.
so i am wondering whats preventing the code from working successfully from the server?
I tried the same code from another domain and it worked.
I am yet to find out if it was not working because of the way the 1st domain was sending CURL requests, or if the domain was blacklisted for posting too much in the past.
either way, facebooks error messages are not at all helpful!
If you're using your own wall, notice the difference between:
"me/feed" and "me/photos" url. The first one doesn't work!!!
I also tried the same thing but unfortunately it works for online images but not for local ones. i.e
'picture' => class_exists('CurlFile', false) ?
new CURLFile($photo, 'image/jpg') : "#{$photo}",
will not work, but
'picture' => "http://i.stack.imgur.com/VGWZD.jpg?s=24&g=1",
will work
I also had some problems with this. Weirdly enough it only worked when I sent the url to the picture without any URL encoding via the POST request to the Graph API.
Try the link without the quotation marks "". I was stuck as you but not any more without the quotation marks.

Facebook scrape returns 502 error

I'm just trying to use standard link sharing using Facebook's sharer.php url. Here is a sample link:
https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fbsfurl.com%2FhTM9%2F2%2F2&t=Welcome!
I've been doing this successfully since 2009. Recently the Facebook sharer page seems to no longer be able to access my link to pull in images and a description. Using the Facebook Object debugger,
https://developers.facebook.com/tools/debug/og/
I see that every URL that i try returns a HTTP 502 error. Can someone help me understand why this is happening? Even a static HTML page returns this same error. Here is a screenshot of the error: http://images.publicaster.com/ImageLibrary/account116/images/facebookscrapeerror.png
Testing the URL in a browser works fine: http://stagingclick.publicaster.com/test.htm. this is just a static link no dynamic content, no redirects nothing. I'm a little at a loss of what i can do to fix this error. In my IIS logs i am not able to see the incoming request from Facebook's scraper.
Thanks!
-mark
The page you linked (http://stagingclick.publicaster.com/test.htm) is redirected (via the og:url tag) to http://www.nin.ja which doesn't resolve - are you sure there isn't a similar problem with the live links you're sharing?

Facebook Share button returning error

Example url:
http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fwww.rugbydump.com%2F2011%2F09%2F2124%2Frugby-world-cup-daily-tonga-beat-japan&src=sp
That's what's generated by the Share JS. If you visit the link (after decoding):
[...].com/2011/09/2124/rugby-world-cup-daily-tonga-beat-japan
You can view source and see open graph meta tags.
If the share url is changed to:
[...].com%2F2011%2F09%2F2124%2Frugby-world-cup-daily-tonga-beat-japan2&src=sp
(Adding a 2 to the end of the url) the result is fine. Likewise with other posts:
http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fwww.rugbydump.com%2F2011%2F09%2F2119%2Frugby-world-cup-daily-christchurch-revisted&src=sp
So all I'm getting is "Error" with no way of knowing what went wrong.
Any insight would be great. A thought was that the url was flagged or banned by FB but no way to tell.
[...] is used cause I can't use more than 2 urls.
I re-linted your URL in the Facebook developer debug page:
http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.rugbydump.com%2F2011%2F09%2F2124%2Frugby-world-cup-daily-tonga-beat-japan%2F
and it appears to work fine now. Facebook caches the data obtained from a page, so it's likely they hit your page during a period in which it had an error message instead of the usual contents.