Cordova 1.6.1 android Uncaught TypeError: Cannot call showWebPage method from undefined

I just updated the phone table 1.4.1 to 1.6.1 and also updated the child browser from https://github.com/libbybaldwin/phonegap-plugins/tree/master/Android/ChildBrowser

and I added this line to plugins.xml

<plugin name="ChildBrowser" value="com.phonegap.plugins.ChildBrowser.ChildBrowser"/>

but when i call it

window.plugins.childBrowser.showWebPage( "http://google.com", {
        showLocationBar: true
    });

I get this Uncaught TypeError error: Can't call the 'showWebPage' method undefined

+3
source share
3 answers

Relatively 1.4.1 vs 1.6.1:

Remember that my gitub repo for telephone plugins is that I froze in Internet time to allow further use of phonegap 1.4.1 with plugins of that era.

1.6.1+,

https://github.com/phonegap/phonegap-plugins

. 1.6.1. , README :

http://simonmacdonald.blogspot.com/2012/04/migrating-your-phonegap-plugins-to.html

: 1.4.1 1.6.1+ , .

0

, :

try {
var cb = new ChildBrowser();
console.log(cb);
cb.showWebPage('http://www.google.com');
}catch (err){
console.log(err);
}

:

PhoneGap Build + Cordova + ChildBrowser

- !

0

For several days, we have been reporting the same error and found that you cannot immediately call childBrowser directly from your index.html, probably because it takes some time for the childBrowser plugin to initialize to complete.

This solution works:

setTimeout(function() {
    window.console.log('Opening Childbrowser...');
    window.plugins.childBrowser.showWebPage("http://www.google.com", { showLocationBar: true });
}, 3500);

In other words: you need to wait until the childBrowser object becomes available, but of course there are more elegant solutions.

DISCLAIMER: checked with the current release of 1.7.0rc1 Cordaova, not sure if this works for 1.6.1.

0
source

All Articles