![](/img/trans.png)
[英]JavaScript: How to like a Facebook wall post (given a Facebook page URL and a Facebook post id) using API Graph?
[英]Need to change the caption using the javascript Facebook api to post to wall
我正在使用Facebook javascript发布/发布到用户墙。 以下是我的代码。 每当用户发布到墙上时,他们都会看到如下屏幕。 问题是我在标题文本“Pandora-whichstar are you”之后的标题中得到“www.facebook.com”。 任何想法如何永久删除或更改为更方便的东西?
图片
编码
/facebook: post to wall
function publishWallPost() {
var fbImg = $('.head .headerLeft p img')[0].src;
var fbTxt = $('.head .headRight span.artistName').text();
FB.ui({
method: 'feed',
name: 'Pandora - Which Star Are You',
caption: 'Convenient caption text here?',
description: 'I\'m ' + fbTxt + ' according to Pandora\'s Which Star Are You competition.\n Click on the title to find out which star you are!',
link: 'https://www.facebook.com/pages/xxx/11111111111?sk=app_2222222222',
picture: fbImg
},
function (response) {
console.log('publishStory response: ', response);
});
return false;
}
window.fbAsyncInit = function () {
FB.init({
appId: '2222222222',
status: true,
cookie: true,
xfbml: true
});
};
(function () {
var e = document.createElement('script');
e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
如果Facebook不允许您为Facebook.com上的链接设置标题,那么您可以创建一个页面,将301重定向到您要共享的Facebook页面,并将该URL用作链接参数。
如果301重定向不起作用,您可以改为执行javascript重定向,但仍然适用相同的原则。
就像@Fisch告诉你的那样。 使用JS Redirect构建站点并使用OG Meta Tags。
如果您给出标题或不提供标题,Facebook会废弃URL。
根据授权,Facebook域名网址不会被删除。 链接1
对于无法废弃的网址,主要是从域部分获取标题。[对于这是Facebook在用户手中留下的问题是否继续点击。]
作为Sahil,我担心“字幕编辑”是不可能的。
你不能在网页对话上给出Facebook页面链接。 你需要做@Fisch和@Hackbard告诉你的事情。
你需要提供一些网页的链接,其中包含以下元标记:
<meta property="fb:app_id" content="123456789(your Facebook app id)" />
<meta property="og:title" content="X Y Z"/>
<meta property="og:type" content="game" /> (this depends upon your Facebook settings)
<meta property="og:url" content="www.yourWebpageLink.com/toPullOffDetails" />
<meta property="og:site_name" content="YOUR SITE NAME"/>
<meta property="og:image" content="http://the_image_you_want_to_show_on_that_dialogue"/>
<meta property="og:description" content="This is X Y Z, the best example on the planet" />
使用javascript将window.location('url')
重定向到您的应用页面,如其他人所提到的那样构建一个页面,但您不应该做其他事情。 你所有的配置看起来都没问题。
免责声明: 不要使用服务器端重定向,因为Facebook将找到您需要使用javascript重定向的URL,因为scrappers不执行javascript。
在分享facebook链接时,facebook会自行提供相关标题(有时也会说明)。
如果您尝试除facebook之外的其他链接,并提供caption
参数,您可以在Feed中查看标题。 所以,我担心你不能在你的情况下编辑标题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.