I have Facebook sharing functionality on my website and I am trying to share dynamic data depending on a choice a user has submitted. On desktop, things work fine but on mobile devices, I am running into issues particularly on Windows Mobile. Any ideas how to sort? My code is below:
FB.ui({
method: 'share_open_graph',
action_type: 'og.shares',
action_properties: JSON.stringify({
object: {
'og:url': [url],
'og:title': [pageTitle],
'og:description': [desc],
'og:image': [shareImage]
}
}),
display: 'dialog' // this is being ignored
}, function (response) {
console.log('shared', response);
});
On an apple device, the popup is being blocked and not allowed to show unless user allows popups personally through their own settings. Unfortunately I need to bypass this due to the nature of client base.
Thanks
Related
Implementing Share feature on web application.
While the code below works with your favorite desktop and mobile browsers (Share Dialog shows up when clicking on the Share button), it wont work (the Share Dialog doesn't show up) when the web application is opened via Facebook Android Application (by clicking the Website URL from a post and it open's up from the website)
FB.ui({
method: "share_open_graph",
action_type: "og.shares",
action_properties: JSON.stringify({
object: {
"fb:app_id": "my_app_id",
"og:url": "url_of_my_app",
"og:title": "my_app_title",
"og:description": "my_app_desc",
"og:image": "display_image",
"og:image:width": "600",
"og:image:height": "350"
}
})
}, function (response) {});
Rule of thumb when using FB.ui is to not use FB.ui inside a Promise success callback. Facebook Application is blocking pop-ups when called inside a successful return of Promise.
I have a facebook app, and I am able to share links, and image for this link, on FB, using FB.ui.
The point is, depending for the FB account who is sharing the link, I can get big image, or small one.
This is a real pain, because if I configure and send big image, on the accounts which uses small one, the image is cropped, and also on the other way.
I am sending, as far as I know, all known parameters for FB, but the result is the same.
FB.ui({
method: 'share_open_graph',
action_type: 'og.shares',
action_properties: JSON.stringify({
object: {
'og:title': title,
'og:description': description,
'og:url': invitationLink,
'og:image:url': imgPath,
'og:image:width': imgWidth,
'og:image:height': imgHeight,
'og:image:alt': 'refer a friend by lottoland'
}
})
});
What could be wrong here? How can I "force" facebook to always use same type of image?
Thanks anyone for the support.
https://developers.facebook.com/docs/javascript/reference/FB.ui
With the new update of Facebook API, I've been trying show a dialog for share in timeline, but don't only recognize me the href..
What can I do?
Code:
FB.ui({
name: 'Mejores Huecas',
link: 'www.lasmejoreshuecas.com',
from: '1469541393326876',
caption: 'Las mejores huecas!',
method: 'share',
href: 'https://apps.facebook.com/mejoreshuecas/?fb_source=search&ref=ts&fref=ts',
},
function(response) {
if (response && !response.error_code) {
//alert('Posting completed.');
}
else {
//alert('Error while posting.');
}
}
);
That´s intentional, the Share Dialog reads the data from the Open Graph Tags of the URL and it only takes the href as parameter, as you can see in the docs.
If you want to share custom data, you need to create a separate URL with separate Open Graph tags. After all you share a Link, and the message must be user generated anyway, so you don´t really need additional info - i guess that is why Facebook deprecated the old Feed Dialog.
I am following this thread Is it possible to add a link to download a file that can only be downloaded by sharing it on Facebook? to detect if user share my given link or not, If user share then allow him to access the next level.
This is how i am doing:
FB.ui({
display: 'popup',
method: 'share',
href: 'url-here',
} , function(response){
console.log(response.e2e)
if (response && response) {
$.ajax({
url: ajaxurl,
type: 'post',
data: {action: 'unlock_om_gmap'},
success: function(res) {
}
});
}
});
But everytime its returning Object { e2e="{"submit_0":1406412308276}"} not any post id. Is there anyone familiar with this issue? How do i check if user shared my link or not?
As I mentioned in the comments, as per the Facebook docs on this topic, you'll need to check for an object_id property in the response data to determine if an Open Graph story was shared, but this is only available if the user is logged into your app using Facebook and has granted publish_actions
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.