Mithilfe der JavaScript-API können Sie den Anker-Tag mit FB.getLoginStatus umschließen. Siehe https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/
Beispiel von dieser Seite:
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
// the user is logged in and connected to your
// app, and response.authResponse supplies
// the user's ID, a valid access token, a signed
// request, and the time the access token
// and signed request each expire
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
} else if (response.status === 'not_authorized') {
// the user is logged in to Facebook,
//but not connected to the app
} else {
// the user isn't even logged in to Facebook.
}
});
Hinweis: Ich würde einfach diesen Anruf vorne und stelle meinen eigenen JS Variable boolean auf der Antwort, damit ich nicht den FB-API-Aufruf verwenden musste nochmal. Umschließen Sie dann jeden abhängigen Code mit einem einfachen JS-Booleschen Test.
Was ist das, iframe fb app? Oder eigenständige Site? – serg
an diesem Punkt hat es nichts mit FB zu tun, genau wie jeder autorisierte Zugriffsprozess, wenn Sie eine gültige Sitzung fortfahren, andernfalls Prompt – ifaour