Childbrowser in 0.9.6

322 views
Skip to first unread message

Allister

unread,
Jul 2, 2011, 5:12:30 AM7/2/11
to phonegap
No qute sure what I'm doing wrong here.

I just ran 096 in and started a new project.
Also went to get the most recent versions of plugins and took the
newest childbrowser

Copied correct files over to Plugins dir and added as existing files.
Copied ChildBrowser.bundle into Resources dir and added as existing
files.
Pit ChildBrowser.js into www and referenced in index.

But childbrowser not firing to load google.com as per Index file is
below....

What am I missing?
Thanks,
allister

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-
scale=1.0, maximum-scale=1.0, user-scalable=no;" />

<meta http-equiv="Content-type" content="text/html;
charset=utf-8">

<!-- iPad/iPhone specific css below, add after your main css >
<link rel="stylesheet" media="only screen and (max-device-width:
1024px)" href="ipad.css" type="text/css" />
<link rel="stylesheet" media="only screen and (max-device-width:
480px)" href="iphone.css" type="text/css" />
-->
<!-- If you application is targeting iOS BEFORE 4.0 you MUST put
json2.js from http://www.JSON.org/json2.js into your www directory and
include it here -->
<script type="text/javascript" charset="utf-8" src="phonegap.
0.9.6.min.js"></script>
<script type="text/javascript" charset="utf-8"
src="ChildBrowser.js"></script>
<script type="text/javascript" charset="utf-8">


// If you want to prevent dragging, uncomment this section
/*
function preventBehavior(e)
{
e.preventDefault();
};
document.addEventListener("touchmove", preventBehavior, false);
*/

/* If you are supporting your own protocol, the var invokeString will
contain any arguments to the app launch.
see http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
for more details -jm */
/*
function handleOpenURL(url)
{
// TODO: do something with the url passed in.
}
*/

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

/* When this function is called, PhoneGap has been initialized and is
ready to roll */
/* If you are supporting your own protocol, the var invokeString will
contain any arguments to the app launch.
see http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
for more details -jm */


var root = this;

/* When this function is called, PhoneGap has been initialized and is
ready to roll */
function onDeviceReady()
{
var cb = ChildBrowser.install();
if(cb != null)
{
cb.onLocationChange = function(loc){ root.locChanged(loc); };
cb.onClose = function(){root.onCloseBrowser()};
cb.onOpenExternal = function(){root.onOpenExternal();};

window.plugins.childBrowser.showWebPage("http://www.google.com");

}
}

function onCloseBrowser()
{
alert("In index.html child browser closed");
}

function locChanged(loc)
{
alert("In index.html new loc = " + loc);
}

function onOpenExternal()
{
alert("In index.html onOpenExternal");
}

</script>
</head>
<body onload="onBodyLoad()">
<h1>Hey, it's PhoneGap!</h1>
<p>Don't know how to get started? Check out <em><a href="http://
github.com/phonegap/phonegap-start">PhoneGap Start</a></em>
</body>
</html>

Dewey

unread,
Jul 2, 2011, 5:27:52 AM7/2/11
to phon...@googlegroups.com
What's the output on the console? Not sure if you're on iOS, but if you are check http://wiki.phonegap.com/w/page/41733808/PhoneGap-iOS-Plugins-Problems. Did you add the plugin to the Phonegap.plist? 

<key>ChildBrowserCommand</key>
<string>ChildBrowserCommand</string>

Shazron Abdullah

unread,
Jul 2, 2011, 8:49:26 AM7/2/11
to phon...@googlegroups.com
Check your console logs. Read the release notes as well.

http://wiki.phonegap.com/w/page/41733808/PhoneGap-iOS-Plugins-Problems

> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com

Allister

unread,
Jul 2, 2011, 10:45:06 AM7/2/11
to phonegap
Thanks - that did it.

I eventually figured out it was called
ChildBrowserCommand

not ChildBrowser

allister

On Jul 2, 1:49 pm, Shazron Abdullah <shazron.abdul...@nitobi.com>
wrote:
> Check your console logs. Read the release notes as well.
>
> http://wiki.phonegap.com/w/page/41733808/PhoneGap-iOS-Plugins-Problems
>
> > json2.js fromhttp://www.JSON.org/json2.jsinto your www directory and
> > include it here -->
> >    <script type="text/javascript" charset="utf-8" src="phonegap.
> > 0.9.6.min.js"></script>
> >        <script type="text/javascript" charset="utf-8"
> > src="ChildBrowser.js"></script>
> >    <script type="text/javascript" charset="utf-8">
>
> >    // If you want to prevent dragging, uncomment this section
> >    /*
> >    function preventBehavior(e)
> >    {
> >      e.preventDefault();
> >    };
> >    document.addEventListener("touchmove", preventBehavior, false);
> >    */
>
> >    /* If you are supporting your own protocol, the var invokeString will
> > contain any arguments to the app launch.
> >    seehttp://iphonedevelopertips.com/cocoa/launching-your-own-application-v...
> >    for more details -jm */
> >    /*
> >    function handleOpenURL(url)
> >    {
> >        // TODO: do something with the url passed in.
> >    }
> >    */
>
> >    function onBodyLoad()
> >    {
> >        document.addEventListener("deviceready",onDeviceReady,false);
> >    }
>
> >    /* When this function is called, PhoneGap has been initialized and is
> > ready to roll */
> >    /* If you are supporting your own protocol, the var invokeString will
> > contain any arguments to the app launch.
> >    seehttp://iphonedevelopertips.com/cocoa/launching-your-own-application-v...

Steven L

unread,
Jul 4, 2011, 1:00:38 AM7/4/11
to phonegap
Hey Allister,
I'm having the exact same problem I believe.
Can you clarify which instanced of "ChildBrowser" had to be changed to
"ChildBrowserCommand"?

The only place I have made that change so far is in the PhoneGap.plist
where I have <key>ChildBrowserCommand</key>
<string>ChildBrowserCommand</string>.

Anywhere else?

I've got this button on the page to test: <button
onclick="openChildBrowser('http://www.google.com ');">Open Google</
button>

I'm getting these error outputs

2011-07-04 00:59:04.272 Alpha[4403:207]
PhoneGapDelegate::shouldStartLoadWithRequest: Received Unhandled URL
about:blank
2011-07-04 00:59:04.274 Alpha[4403:207] PGPlugin class
ChildBrowserCommand (pluginName: ChildBrowserCommand) does not exist.
2011-07-04 00:59:04.274 Alpha[4403:207] ERROR: Plugin
'ChildBrowserCommand' not found. Check your plugin mapping in
PhoneGap.plist.


Thanks!
> > > json2.js fromhttp://www.JSON.org/json2.jsintoyour www directory and

Allister

unread,
Jul 4, 2011, 5:56:03 AM7/4/11
to phonegap
make sure it's placed into the plugins section of PhoneGap.plist
(there should be around 14 already in there)
allister
> > > > json2.js fromhttp://www.JSON.org/json2.jsintoyourwww directory and

Steven L

unread,
Jul 4, 2011, 7:39:46 PM7/4/11
to phonegap
Yeah that part was ok.
I just got it fixed. Had to do with the way the ChildBrowser was
imported into the project. Was blue folder, need to import so it's
yellow...

Thanks

On Jul 4, 5:56 am, Allister <allister.fug...@om.org> wrote:
> make sure it's placed into the plugins section of PhoneGap.plist
> (there should be around 14 already in there)
> allister
>
> On Jul 4, 6:00 am, Steven L <ste...@drivv.com> wrote:
>
>
>
>
>
>
>
> > Hey Allister,
> > I'm having the exact same problem I believe.
> > Can you clarify which instanced of "ChildBrowser" had to be changed to
> > "ChildBrowserCommand"?
>
> > The only place I have made that change so far is in the PhoneGap.plist
> > where I have <key>ChildBrowserCommand</key>
> > <string>ChildBrowserCommand</string>.
>
> > Anywhere else?
>
> > I've got this button on the page to test: <button
> > onclick="openChildBrowser('http://www.google.com');">Open Google</
> > button>
>
> > I'm getting these error outputs
>
> > 2011-07-04 00:59:04.272 Alpha[4403:207]
> > PhoneGapDelegate::shouldStartLoadWithRequest: Received Unhandled URL
> > about:blank
> > 2011-07-04 00:59:04.274 Alpha[4403:207] PGPlugin class
> >ChildBrowserCommand(pluginName:ChildBrowserCommand) does not exist.
> > > > > json2.js fromhttp://www.JSON.org/json2.jsintoyourwwwdirectory and
Message has been deleted

Nick Collings

unread,
Jul 27, 2011, 7:27:09 AM7/27/11
to phon...@googlegroups.com
Just to clarify for any future readers as it took a bit of experimenting for me to work it out...

In order to import a plugin as a yellow folder rather than a blue you drag the plugin folder onto the Plugins folder in Xcode and ensure "Create groups for any added folders" is checked before clicking finish.

JustinS

unread,
Jul 27, 2011, 12:10:19 PM7/27/11
to phon...@googlegroups.com
I'm having the same issue that Steven L mentioned, but I'm my lost as to what the fix was.

I have the ChildBrowserController folder imported into my Plugins (imported as a yellow folder, not blue) with the supporting files (ChildBrowserCommand.h, etc).  However, when I run my app, I still get the 'ERROR: Plugin 'ChildBrowserCommand' not found, or is not a PGPlugin. Check your plugin mapping in PhoneGap.plist.' error when I run it.

In my PhoneGap.plist, I haven't edited any of those values, so it is the default 12 values that came with the plugin (I didn't see any thing in the readme/tutorials that suggested adding values, so I didn't).  Do I need to add a value to the PhoneGap.plist for the ChildBrowserController?

I've updated to the latest version of ChildBrowser, and my ChildBrowserController.h has these for the imports:

#ifdef PHONEGAP_FRAMEWORK

    #import <PhoneGap/PGPlugin.h>

    #import <PhoneGap/NSData+Base64.h>

    #import <PhoneGap/JSON.h> 

#else

    #import "PGPlugin.h"

    #import "NSData+Base64.h"

    #import "JSON.h" 

#endif


Is there something I'm missing?  I can't tell what the suggested fix was between the conversations earlier, if someone could help me out, I'd appreciate it.


Thanks

JustinS

unread,
Jul 27, 2011, 2:12:25 PM7/27/11
to phon...@googlegroups.com
I actually just managed to get it working.  For those who may receive the error I had ('ERROR: Plugin 'ChildBrowserCommand' not found, or is not a PGPlugin. Check your plugin mapping in PhoneGap.plist.), you'll need to add the plugin name to the PhoneGap.plist Plugins section.  I know this was expressed earlier, but I had trouble finding out what the name was.  It is:

Key: ChildBrowserCommand
Type: String (default)
Value: ChildBrowserCommand


Reply all
Reply to author
Forward
0 new messages