Add external page action link to fb.ui share dialog - facebook

Using Facebook's now deprecated feed dialog, I used to be able to pass in an actions parameter containing a link to an external URL.
For example:
FB.ui({
method: 'feed',
href: 'http://www.example.com',
actions: [{
name: 'Learn More',
link: 'http://www.example.com/learn'
}]
});
I now want to use the share dialog, and am using open graph meta properties to customize the content being shared. I've been reading about the open graph action types, but haven't found anything about how to add an action link to the share dialog that simply links to an external page like the example above does. Does anyone know how I could do this? Thanks!

Related

Dynamically pass link to facebook share button

I literally searched the internet from top to bottom but I can't find the answer.
Is it possible to dynamically pass links to facebook share button or dynamically create multiple share buttons, each on click? I was trying to achieve it with js, but I could only generate one button at time and couldn't change the link on it. Any suggestions, links to articles?
You can use the Share Dialog to share dynamic links with JavaScript and the Facebook JavaScript SDK:
FB.ui({
method: 'share',
href: 'https://developers.facebook.com/docs/',
});
Source: https://developers.facebook.com/docs/sharing/reference/share-dialog/

Configure Facebook share dialog to show the default as "Friends' Timeline"

To open a regular share dialog like this one:
I use this following code:
FB.ui({
method: 'share',
href: 'https://www.happymood.co',
}, function(response){});
Now if I want the default option to show "On your Friends' Timeline" instead of "On your own Timeline", what changes must I make to this code?
It´s not possible at all to define another default setting. You can check out the Facebook docs to see what parameters you can use: https://developers.facebook.com/docs/sharing/reference/share-dialog

Facebook Feed Dialog Parameters vs. Open Graph Meta Tags

Do the Open Graph meta tags override the corresponding parameter values passed in FB.ui?
I have a page where I have an og:description tag (I want it to be used by the like button). I have a share button which triggers a share dialog using FB.ui.
Coffeescript Code:
FB.ui({
method: 'feed',
link: Selfstarter.baseUrl(),
caption: caption,
name: 'Healthfundit',
description: 'Some Description',
actions: [{name:'Help Fund It!', link: Selfstarter.baseUrl() + "/preorder/checkout" }]
source: source
}, (response) ->);
When I test the share button, the description that is displayed is the one I specified in the og:description tag.
Do the Open Graph meta tags override the corresponding parameter values passed in FB.ui?
No, the other way around.
If that’s not working for you, then most likely there’s an error in your code. [As we figured out, that was it.]

How can I add CSS to FB feed dialog?

I am new to facebook API. I've integrated feed dialog successfully. I want to add some CSS to feed dialog. How can I load a FB feed dialog in a DIV tag so that I can add some text above the FB dialog. (For ex: text like share it with your friends... and some instructions)
To display the feed dialog I've used JavaScript SDK. Below is the code...
FB.ui({
method: 'feed',
name: 'Feed dialog',
link: 'http://testmysite.com',
display: 'iframe'
}function(response) {
if (response && response.post_id) {
alert("successful");
});
Any help would be appreciated.
Thanks
Facebook Dialogs are not customizable in this fashion. From Facebook's documentation (emphasis mine):
Dialogs provide a simple, consistent interface to display dialogs to users.
You might want to create your own dialog and use the appropriate Facebook Graph API calls to post to a user's feed.
You cannot style Facebook ui elements, such as the like button share button, ui dialog etc. You can only customize the ui through the parameters Facebook provides you. For the full list of parameters look https://developers.facebook.com/docs/reference/dialogs/feed/. A quick look, and I dont think you can customize the text on the ui dialog.
Hope this helps,
Tyrone

How do you add a custom share link to a FBML page on facebook?

I'd simply like to make an image-click in my FBML page to trigger facebook's ajax dialog box. How do I accomplish this?
I have an FBML tab on my facebook fan page. In the content of that tab, I would like an image to function as a share button.
By following these directions, I can customize a share button, but the image itself that the user clicks on is not customizable. I want to be able to provide my own image, not use the silver share button provided by facebook.
By following these alternative directions I can use my own image. Perfect! Except on thing... Share.php opens as a page instead of as a javascript dialog. So when the user completes the dialog, it closes the whole page!
Here's what it looks like right now. Sorry, you have to click "Like" to see the share image. When you click the image, the share page opens, but I just want the ajax dialog.
I believe you can do what you want using the facebook feed dialogs:
http://developers.facebook.com/docs/reference/dialogs/
this is the javascript that you will have to bind to your onClick event of your link:
FB.ui(
{
method: 'feed',
name: "Name",
link: "http:\\www.facebook.com\pages\#\page_id_here",
picture: "http:\\path\to\image\file.jpg",
caption: "Caption",
description: "Description",
message: "Message"
},
function(response) {
//callback function
}
);