2012-06-07 4 views
0

phonegap에 Facebook 플러그인을 사용하고 있습니다. 거기에 ChildBrowser를 사용하여 로그인이 성공하면 외부 URL을 엽니 다. openExternal을 호출했지만 onLocationChange가 호출되지 않으면 지정된 웹 페이지가 제대로 열립니다. 코드에 어떤 문제가 있는지 알려 주시면 좋을 것입니다. 다음과 같이 코드가 ChildBrowser에 대한 onLocationChange 메소드가 호출되지 않습니다.

init:function(){ 

    // Begin Authorization 
    var authorize_url = "http://graph.facebook.com/oauth/authorize?"; 
    authorize_url += "client_id=" + my_client_id; 
    authorize_url += "&redirect_uri=" + my_redirect_uri; 
    authorize_url += "&display=" + my_display; 
    authorize_url += "&scope=publish_stream,offline_access" 


    // Open Child browser and ask for permissions 
    client_browser = ChildBrowser.install(); 

    if (client_browser != null) { 
     alert("In the init section " + client_browser); 

     client_browser.onLocationChange = function(loc){ 
      alert("Log location = " + loc); 

     };    

     window.plugins.childBrowser.openExternal(authorize_url); 

    } 

} 

나는 또한

window.plugins.childBrowser.onLocationChange = function(loc){ 
     alert("In the client_browser section "); 
     Facebook.facebookLocChanged(loc); 
    }; 

을 시도 ...하지만이 또한 작동하지 않습니다. 도움이나 제안을 보내 주시면 감사하겠습니다. 감사합니다. .

답변

0

openExternal은 Android 웹 브라우저를 열고,이 경우에는 onLocationChanged 이벤트가 호출되지 않습니다. onLocationChanged 이벤트를 가져 오려면 showWebPage를 사용해야합니다.

+0

답변 해 주셔서 감사합니다. onLocationChange 이벤트는 언급 한 변경 작업을 수행 한 후 지금 호출 중입니다. – namrathu1

+0

그런 다음 동일한 문제를 검색하는 다른 사람들의 대답을 받아 들여야합니다. –

+0

오, 방금했습니다. 미안해. 내가 받아 들일 수있는 옵션에 대해 몰랐어. 또 고마워. – namrathu1

관련 문제