我目前正在爲使用新時間軸佈局的客戶端構建一個Facebook應用程序,這意味着沒有着陸頁等等。無論如何,我們希望用戶使用的應用程序有一個煩人的'範蓋茨',你必須'喜歡'的頁面,然後才能查看完整的應用程序。我們決定在頁面內部有一個「Like」按鈕,這意味着我需要在點擊Like之後手動執行刷新/重定向,以顯示正確的應用程序。重定向在Facebook應用程序中的'Like'(IE7)
我使用這個代碼來實現這一目標:
<div id="fb-root"></div>
<script>
(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_GB/all.js#xfbml=1&appId=xxxx";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<script>
window.fbAsyncInit = function() {
// Javascript SDK Settings
FB.init({
appId : 'xxx',
status : true, // check login status
channelUrl : 'https://www.xxx.com/assets/apps/channel.html', // Channel File
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Automatically increase height of our canvas.
FB.Canvas.setAutoGrow();
// When they click the like button within our app refresh the page and take them to our app.
FB.Event.subscribe('edge.create', function(href, widget) {
window.top.location = '//www.facebook.com/xxx/app_xxx';
});
};
</script>
<div id="like"><div class="fb-like" data-href="xxx" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false"></div></div>
<img src="/assets/apps/lyc/img/nolike.jpg" />
要快速穿行它有被列入類似按鈕,我需要的功能的JavaScript SDK。然後我設置SDK設置,自動增加iframe的長度,並最終獲得點擊事件功能,如果按鈕被點擊,我將它們帶到應用程序頁面。
這在除IE7以外的任何地方都能正常工作。當你點擊IE7中的「Like」時,它只是坐在那裏,不會運行重定向。雖然我看不到任何錯誤。正如我所說的所有其他瀏覽器做重定向。
我一直堅持這一段時間,所以任何幫助將不勝感激。
乾杯
謝謝@GilBirman,我會給你一個嘗試並讓你知道。 – Ben 2012-03-30 00:26:56
剛剛意識到我從來沒有回覆這個抱歉。這最終並沒有爲我解決問題,但幫助我指出了正確的方向。不幸的是,這是很久以前,我不記得確切的修復。 – Ben 2013-02-12 22:11:03