开发者

ChildBrowser Plugin of PhoneGap displaying an error

Recently i built an android app in PhoneGap , and now i want a twitter sharing feature so i am planning to add a childbrowser where i will give the url of twitter sharing. Now i have done all the steps given in ChildBrowser Github and also i have used ondevice ready function, but my code is displaying an error in the emulator as soon as i hit the tweet button ie. " TypeError: window.plugins.childBrowser is undefined " . Now um almost trying on this code f开发者_运维技巧or more than 7 hours and unable to solve it . can anyone tell where i am wrong ? i am pasting the code below

<title> Javascript Code</title>

    var childBrowser; 

    function onBodyLoad() 
    { 
    document.addEventListener("deviceready",onDeviceReady,false); 
    } 

    function onDeviceReady() 
    { 
        phoneGapReady.innerHTML = "PhoneGap is Ready"; 
        childBrowser = ChildBrowser.install(); 
    }

    function openChildBrowser(url) 
    { 

        try 
        { 
             //alert("check");
            //both of these should work... 
            window.plugins.childBrowser.showWebPage(url); 
            childBrowser.showWebPage(url); 
        } 
        catch (err) 
        { 
            alert(err); 
        } 
    } !-- end of Javascript function  <body onload="onBodyLoad()">   <a onclick="openChildBrowser('http://www.google.com')">  <img style="float:left" src="tweet.jpg" style="margin-left:10px" width="100" height="40"> </a>


Its possibly a scope issue....

http://www.mredkj.com/tutorials/reference_js_intro_ex.html

also try

var childBrowser = ''; 

or

var childBrowser = null;


Have you included childbrowser.java childbrowser.js and phonegap.js files?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜