From my hybrid app on iPad, I want to share specific URLs through FB and Twitter when the user clicks the appropriate button. Here is what I did for twitter (which worked):
shareStyleOnTwitter : function(styleId, title) {
var httpUrl = 'twitter://post?message=';
var url = 'www.mywebsite.com/'+styleId;
var params = 'Check out '+title+' on #mywebsite '+url;
window.location = httpUrl+encodeURIComponent(params);
}
This opens a Twitter application with a post dialog with a message in it. The user just has to click the "tweet" button to publish.
Here I use the FB function (which does not work):
shareStyleOnFB : function(styleId, title, imageUrl){
var httpUrl = 'fb://publish/profile/#me?text=';
var params = 'www.mywebsite.com/'+styleId;
console.log(httpUrl+encodeURIComponent(params));
window.location = httpUrl+encodeURIComponent(params);
},
This opens the FB application with my feed, but does not have an exchange / message / status window with a message.
I took these ideas from these threads:
What are all the custom URL patterns supported by the iPhone Facebook app?
How can I open twitter twitter using native twitter app on iOS?
- , URL- FB?