本文介绍了参考错误:找不到变量:ChildBrowser,Cordova 1.7.0,jQueryMobile 1.0.1,iOS 5.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用我的第一个PhoneGap / Cordova应用程序,并使用jQueryMobile。我试图让ChildBrowser插件工作,但尝试调用

I'm working on my first PhoneGap/Cordova app and using jQueryMobile as well. I'm trying to get the ChildBrowser plugin working but getting the error in the title when trying to call

ChildBrowser.install()

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

Its in my onDeviceReady function which is being called correctly and I've even verified that the ChildBrowser.js file is being called by adding an alert and wrapping the anonymous function that file in a try/catch and it does not seem to be throwing any errors during its execution. However the var does not seem to be valid within my index.html file.

大概有一些'gotcha'在这里我不知道。任何想法?

Presumably there is some 'gotcha' here I am not aware of. Any thoughts?

提前感谢。

推荐答案

及其关联的帖子,似乎

Combining info from http://blog.digitalbackcountry.com/2012/03/installing-the-childbrowser-plugin-for-ios-with-phonegapcordova-1-5/ and his linked post https://github.com/phonegap-starter/ChildBrowserPlugin it appears that the

ChildBrowswer.install();

步骤。我现在也使用jQueryMobile 1.1。用于在下面包括的ChildBrowser中启动google的示例函数。我从第一个链接跟踪.plist设置。

step is no longer necessary. I am now using jQueryMobile 1.1 as well. Example function used to launch google in the ChildBrowser included below. I followed the .plist setup from the first link.

    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>

希望这可以帮助别人,因为这个问题没有回答几天。

Hopes this helps someone else as this question went unanswered for a couple of days.

这篇关于参考错误:找不到变量:ChildBrowser,Cordova 1.7.0,jQueryMobile 1.0.1,iOS 5.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 07:30