檢查: fb_window_redirect
覆蓋德window.open方法。這可以讓你知道打開了哪些窗口。
然後您可以重定向FB SDK打開的窗口。
...
window._open = window.open; // saving original function
//Override the function
window.open = function(url,name,params) {
var new_window = window._open(url,name,params);
if (typeof onWindowOpen === "function") {
onWindowOpen(url, name, params, new_window);
}
return new_window;
};
...
var openedWindows = [];
var fbWindows = [];
function onWindowOpen(url, name, params, new_window) {
...
// Filter the facebook oauth request
if (url.contains('facebook.com')
&& url.contains('oauth')) {
fbWindows.push(new_window);
}
openedWindows.push(new_window);
}
...
//On fb login button pressed callback:
FB.login(function(response) {
//Try login
if(response.authResponse) {
//Login succesful
// Fb window redirect.
// see onWindowOpen
var fbwin = fbWindows[0];
var redirect_url = ''
fbwin.location = redirect_url;
}
},
{scope: 'email,publish_stream,user_birthday'});
...
發生在我身上,好像只是另一個ios8錯誤。你可能想要回到服務器端身份驗證,如這裏所說http://stackoverflow.com/a/26052127/2880184 – 2014-10-05 18:56:01
謝謝,工程很好,並不像它在dekstop上那樣糟糕。 – binoculars 2014-10-06 13:15:46