window.location.href不PhoneGap的应用工作 [英] window.location.href doesn't work in phonegap app

查看:204
本文介绍了window.location.href不PhoneGap的应用工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于一些奇怪的原因,我的Facebook Connect不,我在建筑应用工作,后接一个空白的屏幕,并将其死亡。

For some strange reason my Facebook connect does not work in my app in building, after it connect a blank screen it and it dies.

我的脚本可以在浏览器中,黑莓10的WebWorks应用程序,在我的黑莓Z10,Galaxy Tab的,剧本的浏览器,甚至在电脑上正常工作,但不是在应用它的自我。
我知道黑莓10,你需要禁用浏览器应用程序,我试过,但没有奏效。

My script works in browser, BlackBerry 10 webworks app, browser on my BlackBerry Z10, Galaxy Tab, Playbook, even on the computer it works fine, but not in the app it self. I know on BlackBerry 10 you need to disable the app in browser, i tried but did not work.

<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);
}

我尝试替换指定HREF,更换也没有工作,然后在电脑上就没有工作了。

I try to replace the href with assign, replace but also not worked and then on the computer it didn't work anymore.

我试图改变window.open到window.location.assign也没有工作。
任何人有这方面的经验?

I tried to change window.open to window.location.assign but also that did not work. Anyone have experience with this?

推荐答案

您需要使用此

window.location.replace("link.html");

这篇关于window.location.href不PhoneGap的应用工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆