2010-08-09 130 views
1

當我在Facebook的iframe應用程序中進行服務器端重定向時,我得到這個奇怪的Facebook徽標與鏈接。當我點擊它時,我將重定向到站點,我首先將重定向設置爲。這裏發生了什麼?任何「點擊保護」到位?Facebook Iframe應用程序 - 奇怪的重定向問題

謝謝!

重定向代​​碼:
嘗試客戶端重定向

args = dict(client_id=FACEBOOK_APP_ID, redirect_uri=base_dir , scope='user_photos,email,offline_access') 
    return render_to_response('fb/nopermission.html', { 'javascript': "<script>window.top.location=\"" + "https://graph.facebook.com/oauth/authorize?" + urllib.urlencode(args)+ "\"</script>" }) 

服務器重定向:

args = dict(client_id=FACEBOOK_APP_ID, redirect_uri=base_dir , scope='user_photos,email,offline_access') 
return HttpResponseRedirect(https://graph.facebook.com/oauth/authorize?" + urllib.urlencode(args)) 

在這兩種情況下相同的結果

alt text

+0

你重定向到什麼網址? – 2010-08-09 14:42:03

+0

http://stackoverflow.com/questions/3380876/how-to-authorize-facebook-app-using-redirect-in-canvas/3380939#3380939 – serg 2010-08-09 16:45:41

+0

編輯我的問題 – 2010-08-09 18:45:46

回答

0

Arrgh! Facebook有這樣一個糟糕的文檔,我在爲它開發時遇到了很多問題。

這一個是因爲你不能直接從你的應用程序重定向。使用href鏈接並將目標屬性指定爲_top或使用javascript解決此問題。

0

重定向目的使用此代碼:

<html><head> 
<script type="text/javascript"> 
    window.top.location.href = "<?php echo $loginUrl; ?>"; 
</script> 
<noscript> 
    <meta http-equiv="refresh" content="0;url=<?php echo $loginUrl; ?>" /> 
    <meta http-equiv="window-target" content="_top" /> 
</noscript>