After searching for a suitable way to open a browser within my app, i came across ChildBrowser, which looked like it offered everything I was after. After following a few tutorials, i cannot seem to get the plugin to work. I have edited my PhoneGap.plist file for external hosts with a value of “*”, I have added in the plugins the ChildBrowserCommand, but when ever i run the application, nothing happens when i click the link. I have the following code in the head of my document;
<script type="text/javascript">
var childBrowser;
function onBodyLoad ()
{
document.addEventListener("deviceready", onDeviceReady, false);
}
//Phonegap ready to go
function onDeviceReady()
{
alert("PhoneGap is ready");
childBrowser = ChildBrowser.install();
}
function openChildBrowser(url)
{
try {
window.plugins.childBrowser.ShowWebPage(url);
//childBrowser.showWebPage(url);
}
cathc(err)
{
alert(err);
}
}
</script>
I have the ChildBrowser included straight after my phoneGap.js file but cannot seem to get it to run and i get no errors logged in the console. Does anyone know what is wrong or at least point me in the right direction?
After spending hours/days chasing many confusing pages on the topic, I finally found a concise set of instructions in this blog page. Be sure to grab the latest code as shown in this github page. I was successful in getting the ChildBrowser plugin to work with PhoneGap 1.5.0 in Xcode 4.3 running in OSX 10.7.3 – and tested in iOS 4 and 5. Limitation I discovered is that it only works in portrait mode. I am now pursuing a resolution to include landscape mode.