1
這是我如何實現的Facebook訂閱對話框到我的網頁:
HTML標籤:禁用Facebook的訂閱對話的重定向功能發送後/取消按鈕被點擊
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#" xmlns:og="http://opengraphprotocol.org/schema/">
的JavaScript:
(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/all.js#xfbml=1&appId=***************";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
FB.init({
appId: '***************',
display: 'popup',
status: true,
cookie: true,
xfbml: true,
oauth: true,
method: 'send'
});
發送鍵:
<a onclick="javascript:twitter(this); return false;" href="https://www.facebook.com/dialog/feed?display=popup&app_id=***************&name=<name>&link=<link>&redirect_uri=<uri>">
<div class="fb-container"></div>
</a>
在這裏,我使用Twitter的彈出腳本,因爲display:popup
不起作用,不知道爲什麼。
但是,彈出窗口出現,我發送的飼料。但後來我被重定向到redirect_uri
。我不想要這個。我只想在點擊發送或取消按鈕後關閉彈出窗口。我嘗試了一下,比如檢測一個按鈕是否被點擊,然後嘗試window.close;
,但沒有成功,因爲它是一個新窗口(彈出窗口)。
任何想法?
我昨天但是由於找到了答案。這是解決方案。 – enenen
它沒有重定向工作嗎?據我在很多地方看到的,Feed對話框總是重定向。 – geekazoid