here之前已经问过这个问题,但没有一个答案对我有用,因为所有答案都已过时。
我创建了一个名为fb.htm
的简单HTML页面,其中包含以下代码:
<html>
<head>
<title>Using Facebook JavaScript SDK</title>
<script>
window.fbAsyncInit = function () {
FB.init({
appId: '6534****4714513',
xfbml: true,
version: 'v2.0'
});
FB.ui(
{
method: 'feed',
name: 'The Facebook SDK for Javascript',
caption: 'Bringing Facebook to the desktop and mobile web',
display: 'popup',
redirect_url: 'localhost:2213/Desktop/fb.htm',
description: (
'A small JavaScript library that allows you to harness ' +
'the power of Facebook, bringing the user\'s identity, ' +
'social graph and distribution power to your site.'
),
link: 'https://developers.facebook.com/docs/reference/javascript/',
picture: 'http://www.fbrell.com/public/f8.jpg'
},
function (response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
};
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) { return; }
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'facebook-jssdk'));
</script>
</head>
<body>
<div class="fb-like" data-send="true" data-width="450" data-show-faces="true">
</div>
</body>
</html>
我可以在页面中看到按钮和分享按钮,但在弹出页面中是:
API错误代码:191 API错误说明:指定的URL不归应用程序所有 错误消息:redirect_uri不归应用程序所有。
我在IIS上测试了此页面并尝试将addresses:localhost
,localhost/fb.htm
和localhost:2213/Desktop/fb.htm
添加为应用程序网址但未成功。你能帮我吗?