我的网页上有一些产品列表。我想给每个产品分享链接。我从How to share individual product image in facebook 这里得到了这个代码。但是通过这段代码,它只是进入用户的HOME页面。它不会重定向到所需的。这是我正在使用的代码。我正在为购物车网站开发这个。
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title>My Feed Dialog Page</title>
</head>
<body>
<div id='fb-root'></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<p><a onclick='postToFeed(); return false;'><img title="Like us on Facebook (by niftybuttons.com)" src="http://www.niftybuttons.com/facebook/like_us_on_facebook_for_my_website.png" alt = "fb image"></a></p>
<p id='msg'></p>
<script>
//FB.init({appId: "YOUR_APP_ID", status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
redirect_url: 'https://www.facebook.com/appcenter/fbiphone?fb_source=search&redirect_uri=https%3A%2F%2Fwww.facebook.com%2Fapps%2Fapplication.php%3Fid%3D6628568379&fref=ts',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
</script>
</body>
</html>
当我运行此代码时,它将转到重定向页面,但如果用户提供其凭据,则会显示“抱歉..发生错误...请稍后尝试并按一下确定按钮。如果我点击确定按钮然后它会转到用户FB主页'.. 任何人都可以告诉我,我必须进行哪些更改才能转到所需的页面并删除即将点击登录的错误?