【发布时间】:2014-03-07 10:40:44
【问题描述】:
由于某种奇怪的原因,我的 Facebook 连接无法在我的应用程序中运行,在它连接一个空白屏幕后它就死了。
我的脚本可以在浏览器、BlackBerry 10 webworks 应用程序、我的 BlackBerry Z10 上的浏览器、Galaxy Tab、Playbook 中运行,即使在计算机上也可以正常工作,但在它自身的应用程序中却不能。 我知道在 BlackBerry 10 上您需要在浏览器中禁用该应用程序,我试过但没有用。
<feature name="InAppBrowser">
<param name="android-package" value="org.apache.cordova.InAppBrowser"/>
</feature>
function fboauthstart() {
var url = 'https://graph.facebook.com/oauth/access_token?client_id=' + facebookOptions.clientId + '&redirect_uri=' + facebookOptions.redirectUri + '&client_secret=' + facebookOptions.clientSecret + '&code=' + authCode;
$.ajax({
type: 'GET',
url: url,
success: function(data) {
var response = data;
var response = response.split('&');
var theAccessToken = response[0].split('=');
window.accessToken = theAccessToken[1];
fbfirstlinkcheck();
}
});
}
function startOAuth() {
var url = 'https://www.facebook.com/dialog/oauth?client_id=' + facebookOptions.clientId + '&redirect_uri=' + facebookOptions.redirectUri + '&scope=email,read_friendlists,user_online_presence,publish_stream,user_birthday,user_location';
childWindow = window.open(url, '_blank');
window.int = self.setInterval(function() {
var currentURL = childWindow.window.location.href;
var callbackURL = facebookOptions.redirectUri;
var inCallback = currentURL.indexOf(callbackURL);
if (inCallback == 0) {
window.clearInterval(int)
var code = childWindow.window.location.search;
code = code.split('code=');
code = code[1];
window.authCode = code;
childWindow.close();
setTimeout(function() {
fboauthstart();
}, 1000);
}
}, 1000);
}
我尝试用assign替换href,replace但也不起作用,然后在计算机上它不再起作用了。
我尝试将 window.open 更改为 window.location.assign 但也没有用。 有人有这方面的经验吗?
【问题讨论】:
标签: javascript android facebook cordova