我正在使用phonegap的Facebook插件。在这里,当登录是successful.The时,我使用ChildBrowser打开一个外部url。当我调用openExternal时,指定的网页打开得很好,但是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);
};但这也不起作用。如有任何帮助/建议,我们将不胜感激。谢谢。
发布于 2012-06-08 10:09:33
openExternal打开Android Web浏览器,在这种情况下不会调用onLocationChanged事件。为了获取onLocationChanged事件,您需要使用showWebPage。
https://stackoverflow.com/questions/10940768
复制相似问题