我正在尝试制作一个在facebook上发布状态的网页,但是在FB网页上有脚本我无法做到。
<!DOCTYPE html>
<html>
<body>
<div id="fb-root"></div>
<a href="#" onclick="return postToWall();">Post To Wall</a>
<script src="//connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({ appId: 'XXXX',
status: true,
cookie: true,
xfbml: true,
oauth: true });
function postToWall() {
FB.login(function(response) {
console.log(response);
if (response.authResponse) {
FB.ui({
method: 'feed',
name: 'Facebook Dialogs',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
caption: 'Reference Documentation',
description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
});
} else {
alert('User cancelled login or did not fully authorize.');
}
}, {scope: 'user_likes,offline_access,publish_stream'});
return false;
}
</script>
</body>
</html>
当然我使用了我的应用程序的正确appId。我有沙盒模式的应用程序,因为我还没有任何东西,只有这个脚本。我的网页上只有这个部分可以发布,而其他任何与Facebook无关。
我正在使用xampp在我的计算机中测试它。所以我想在facebook app域我必须写它,但我尝试的一切(localhost,localhost / faceapp / ...)都失败了。例如,我明白了:
Error
App Domains: http://localhost/appFace should not contain protocol information.
出现提示时,您可以编写您的用户和密码,但下一个窗口会告诉您在应用配置和其他内容中不允许使用该网页。我用西班牙语读它,所以我不知道英语中的确切句子。
我已经找到了许多关于此问题的答案,但是大多数都是来自api的先前版本(之后已经改变了),其他人告诉使用localhost左右,我无法保存fb中的更改应用程序写的。
答案 0 :(得分:1)
在FB中的应用程序设置中,将App域设置为“localhost”,如果您使用Login With FB,则在站点URL中输入http:// localhost /(不带空格)或者如果您已创建任何虚拟主机,请输入该...