我正试图通过网址在Facebook上分享链接。我得到了共享工作,但是我没有加载redirectURI,而是关闭弹出窗口。我的代码:
脚本
function fbs_click(width, height) {
var leftPosition, topPosition, u, t, c;
//Allow for borders.
leftPosition = (window.screen.width / 2) - ((width / 2) + 10);
//Allow for title and status bars.
topPosition = (window.screen.height / 2) - ((height / 2) + 50);
var windowFeatures = "status=no,height=" + height + ",width=" + width + ",resizable=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no";
u = 'http://' + share_content.FACEBOOK.SHARE_LINK;
t = share_content.FACEBOOK.SHARE_TITLE;
c = share_content.FACEBOOK.SHARE_CONTENT;
window.open('https://www.facebook.com/dialog/feed?app_id=690028841132472&name='+encodeURIComponent(t)+'&display=popup&caption='+encodeURIComponent(c)+'&link='+encodeURIComponent(u)+'&redirect_uri='+u, 'sharer', windowFeatures);
return false;
}
HTML
<a href="#" onClick="return fbs_click(600, 300)" target="_blank" title="Share This on Facebook"></a>
我发现了一个类似的问题,建议创建一个新页面来关闭弹出窗口。
除此之外还有什么方法吗?