首页 文章

参考错误:找不到变量:ChildBrowser,Cordova 1.7.0,jQueryMobile 1.0.1,iOS 5.1

提问于
浏览
1

我正在开发我的第一个PhoneGap / Cordova应用程序并使用jQueryMobile . 我试图让ChildBrowser插件工作,但在尝试调用时在 Headers 中收到错误

ChildBrowser.install()

它在我的onDeviceReady函数中被正确调用,我甚至通过添加一个警报并在try / catch中包装该文件的匿名函数来验证是否正在调用ChildBrowser.js文件,它似乎没有抛出任何文件执行期间的错误 . 但是var在我的index.html文件中似乎没有效果 .

据推测,这里有一些'陷阱',我不知道 . 有什么想法吗?

提前致谢 .

1 回答

  • 3

    结合来自http://blog.digitalbackcountry.com/2012/03/installing-the-childbrowser-plugin-for-ios-with-phonegapcordova-1-5/和他的链接帖子https://github.com/phonegap-starter/ChildBrowserPlugin的信息,似乎是

    ChildBrowswer.install();
    

    步骤不再是必要的 . 我现在也在使用jQueryMobile 1.1 . 用于在下面包含的ChildBrowser中启动Google的示例函数 . 我从第一个链接开始遵循.plist设置 .

    function onLinkClick() {
        window.plugins.childBrowser.onLocationChange = function(loc){ alert("In index.html new loc = " + loc); };
        window.plugins.childBrowser.onClose = function(){alert("In index.html child browser closed");};
        window.plugins.childBrowser.onOpenExternal = function(){alert("In index.html onOpenExternal");};        
    
        window.plugins.childBrowser.showWebPage('http://www.google.com',
                                        { showLocationBar: true });
        console.log(window.plugins.childBrowser);
    
    }
    

    以及完整性的链接本身

    <p><a href="#" onclick="onLinkClick()">Click here</a> to open a child browser window to Google</p>
    

    希望这有助于其他人,因为这个问题在几天内没有得到答复 .

相关问题