0

我正在使用 ios phonegap 应用程序。我用phonegap2.4.0 创建了一个新项目。这是成功的。但我的问题是 childbrowser 没有出现并在控制台中显示以下错误:

打开网址:无效

我已经完成了在项目中包含子浏览器所需的所有步骤,并且它在旧的 phonegap 项目中运行良好。

我该如何解决这个问题?

function onBodyLoad() {
    document.addEventListener("deviceready", onDeviceReady,false);
}
function onDeviceReady() {
    cb = ChildBrowser.install();
}
function helo() {
    alert("hiiii");
    cordova.exec(null,null,"ChildBrowser","showWebPage",['google.com']);
}
4

2 回答 2

0
function onDeviceReady() {

    if(window.plugins.childBrowser == null)
    {
        ChildBrowser.install();
    }
}

Or You can use InAppBrowser instead of childbrwoser.
For close browser use ref.close();
var ref = window.open("google.com", 'random_string', 'location=no');
ref.addEventListener('loadstart', function(event) {
        console.log(event.type + ' - ' + event.url);
} );
ref.addEventListener('loadstop', function(event) {
        console.log(event.type + ' - ' + event.url);

} );
ref.addEventListener('exit', function(event) {
                     //alert(event.type);
} );
于 2013-10-12T08:38:46.553 回答
0
function onBodyLoad() 
{ 
   document.addEventListener("deviceready", onDeviceReady,false); 
} 
function onDeviceReady() 
{ 
   cb = ChildBrowser.install(); 
} 
function helo() 
{ 
    alert("hiiii"); 
    cordova.exec(null,null,"ChildBrowser","showWebPage",['http://google.com']); 
}
于 2013-10-12T08:39:36.300 回答