I load the FB SDK and have the following function (below) to try and share to facebook.
$(document).on("click",".xxx",function(event) {
FB.ui(
{
method: 'share',
href: 'http://localhost:8000',// The link in feed method
title: 'Testing', // The same than name in feed method
picture: 'http://localhost:8000/static/images/l.jpg',
caption: 'caption',
description: 'Test description',
},
function(response){
// your code to manage the response
});
});
It fails with the below error message:
I'm aware the FB can't read my localhost to retrieve any values it might need. Does anyone know how I can get this to work for testing purposes. Or would it just be easier to get a live environment going at this point?
I use ngrok
to simulate my local notebook as a server, it allows other people to access to my local web application via internet and it works for me to get through development time.
So, ngrok may be one of your choices.
Related
I created an Application in facebook and used in my website.
In my page I am using this function to share a photo.
function postToFacebook(url, img) {
FB.ui({
method: 'feed',
link: url,
picture: img,
name: "Sample name",
description: 'sample desc'
}, function (response) {
console.log(response);
});
}
This function is working and sending a ShareLink on my Time line. But nobody can see my post. I just can see the post on my TimeLine !!!
What it is the problem?
I found out the problem myself.
it is because of the Status of Facebook Application.
Do this setting to fix the problem:
Go to Facebook Developer => You Application => Status & Review => set this option to YES:
"Do you want to make this app and all its live features available to the general public?"
I have my site qa.carryon.com (this is our test site). I have configured it for facebook login and send invitations. In facebook I have configured SiteURL as 'http://login.qa.carryon.com/gs/'. 'login.qa.carryon.com' is our CNAME and we are using Gigya as social third party.
Login is working fine and when users see the list of facebook friends, user will click on one of them and the facebook send dialog triggers. The link parameter for send dialog is something like this 'http://qa.carryon.com/loyalty/signup?userid=xghdt6ys&username=xyz'.
For this link am i getting the error code 100 link invalid or there is other issue in configuration. I am doing this for first time and i cant understand whats going on. Please help i am stuck with no clue.
I had this issue as well and I was using dynamic querystring parameters on a common URL. It seems you are doing the same.
I fixed the issue by forcing Facebook to scrape the URL before I attempt to send it via the FB UI Send Dialog. Use the FB API to hit graph.facebook.com with the URL posted in the id parameter and a scrape parameter set to true.
Like so:
FB.api('https://graph.facebook.com/', 'post', {
id: '[URL]',
scrape: true
}, function(response) {
FB.ui({
method: 'send',
name: '[name]',
picture: '[Picture URL]',
link: '[URL]',
description: '[description]'
});
});
Also answered here.
Does that help?
I am trying to send a facebook private message via facebook send dialog in my facebook app, i have a problem while setting the custom image each time user clicks on it, i am sending the parameters as
send msg
and on the function side,
FB.init({
appId: '<?=$this->facebook->getAppID()?>',
xfbml: true,
cookie: true
});
function send_message(user_id, image_name) {
FB.ui({
to: user_id,
method: 'send',
name: 'The Image',
description: 'Description here',
link: 'https://www.something.com/',
picture: '<?=baseurl()?>imagepath/'+image_name
});
}
It works fine without picture parameter, but all the time it uses default image that facebook automatically pick from my link.
please your kind help will greatly be appreciated!
Using HTTPS protocol in picture link (if you do so), you might cause your problems. Take a look at Images not working in FB.ui
I'm trying to do a basic facebook wall post with an embedded flash object based on the following documentation:
https://developers.facebook.com/docs/reference/dialogs/feed/
I'd like to do this using just a direct URL, like (note parameters get encoded):
https://www.facebook.com/dialog/feed?
app_id=SOME_APP_ID&
link=http://www.myregisteredfbdomain.com/someurl&
picture=http://www.myregisteredfbdomain.com/cfg/media/imagelink.png&
name=Flash%20Test&
caption=Just%20a%20test&
description=A%20Description&
redirect_uri=http://www.myregisteredfbdomain.com/someurl&
source=http://www.myregisteredfbdomain.com/facebook/aflashfile.swf
Although I've also tried it using javascript, with the same result:
<script>
FB.init({appId: SOME_APP_ID, status: true, cookie: true});
function postToFeed() {
var obj = {
method: 'feed',
redirect_uri: 'http://www.myregisteredfbdomain.com/someurl',
link: 'http://www.myregisteredfbdomain.com/someurl',
picture: 'http://www.myregisteredfbdomain.com/cfg/media/imagelink.png',
name: 'Flash Test',
description: 'A Description',
source: 'http://www.myregisteredfbdomain.com/facebook/aflashfile.swf'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
</script>
When I do the post under my development fb account, the post shows up fine, and I can click on the icon which displays the flash correctly.
However when I post under my own personal fb account, the post shows with the image only, but no flash activation when I click it - it just goes to the link/redirect link I defined.
Can anyone give me any pointers as to why this might be the case?
Found out why - It's because I'm accessing the post to my personal account through a https connection, which doesn't show the flash - it's linked via a http connection.
thank you for your time first.
I have a very simple question here,but I can't figure it out for an entire day.
I built an facebook app which just post a message to wall,the problem is it requires user install the app first then request permission,that means 2 clicks,I don't like.
I saw somebody merged the 2 steps into 1,how did he get it?
http://www.permadi.com/tutorial/facebook-js-graph-api-post-to-wall/index2.html
And this one is mine
http://2.youpiaoma.com/fb_api/post2wall.html
Here is the snap of the install page
2.youpiaoma.com/a.JPG
The issue is that you're using the new enhanced auth dialog in your app, and for some reason it is not honoring the &perms=publish_stream parameter. Since the blog is older, some of the code is out of date with the more current ways of doing things.
I think you may benefit from using the new feed dialog instead: https://developers.facebook.com/docs/reference/dialogs/feed/
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
But if you want to continue using the old code, I would suggest the following changes:
you can use the FB.login() call instead of building the string yourself. That way the API is responsible for making the login box correct.
specify a channelUrl in your FB.init() call too. See: http://developers.facebook.com/docs/reference/javascript/FB.init/