Setting Facebook Publish Stream URLs
I am using facebook publishStream method in Facebook FBML Application, some other developer worked on it before me. I am using it some thing like this
Facebook.streamPublish('Publish Shirt Tale. <?php echo $canvasURL.'?req=tale-details&tale_id='.$tale_id?>', attachment);
But there is another url that is under the shared image, see below image for more info
So as in image there is encircle link, so that points towards some other page while I want it to the first page of app. It currently goes to a page some thing like this: http:开发者_如何学Go//apps.facebook.com/apps/application.php?id=xxxxxxxxxxxxx
so can any one tell that where can I specify that URL?
Thanks in advance
As per facebook is deprecating all FBML apps soon, I would advise you to look here, and try and create a dialog in this way. I can give you the script I'm currently using, where the link you circled directs to my app's home page. a note should be made- my app is an Iframe app.
<script type="text/javascript">
FB.ui(
{
method: 'stream.publish',
attachment: {
name: 'name',
caption: 'caption',
source: 'picture.jpg',
picture: 'picture.jpg',
description: 'description',
href: 'http://apps.facebook.com/appname'
},
action_links: [
{ text: 'name', href: 'http://apps.facebook.com/appname' }
]
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
</script>
If you however you would like to keep your app in the FBML form, try this code:
<script type="text/javascript">
FB.ui(
{
method: 'stream.publish',
attachment: {
name: 'name',
caption: 'caption',
source: 'picture.jpg',
picture: 'picture.jpg',
description: 'description',
href: 'http://apps.facebook.com/appname/index.php'
},
action_links: [
{ text: 'name', href: 'http://apps.facebook.com/appname/index.php' }
]
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
</script>
You need to understand the difference between Iframe and FBML apps: While Iframe apps make the user stay in the same page all the time, and only the content in the Iframe is changes, FBML application actually move the user from page to page. Because of this, when specifying links in FBML apps, it is important to use the http://apps.facebook.com/appname/page
link instead of the http://www.yoursite.com/page
link.
Example links:
- A link on your site:
http://www.yoursite.com/game1.php
- Would look like this in an FBML app:
http://apps.facebook.com/appname/game1.php
ok Hafiz then try this code.
FB.ui({ method: 'stream.publish', message:'hello', attachment: { name: title, caption: "I'm running!", media: [{ type: 'image', href: 'http://www.yoursite.com/', src: 'http://www.yoursite.com/images/working.jpeg' }] }, action_links: [{ text: 'Get your percentage', href: 'http://www.yoursite/' }], user_message_prompt: 'Tell your friends about Get your percentage:' });
精彩评论