I am using the Facebook plugin for phonegap. There I am using the ChildBrowser to open an external url when the login is successful.The web page specified opens fine when I call the openExternal but the onLocationChange is not getting called. It will be great if you could let me know what is wrong with the code. The code is as follows..
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);
}
}
I have also tried the
window.plugins.childBrowser.onLocationChange = function(loc){
alert("In the client_browser section ");
Facebook.facebookLocChanged(loc);
};
but this is also not working. Any help/ suggestions would be appreciated. Thanks.
openExternal opens the Android Web Browser, the onLocationChanged event will not be called in that case. You need to use showWebPage in order to get the onLocationChanged event.