2
votes

I am building a phonegap + jquery mobile App, I am trying to add a link that will open a web page in a child browser with the childbrowser phonegap plugin.

I see in the adobe phonegap build site that in order to add the childbrowser plugin I just need to add:

<gap:plugin name="com.phonegap.plugins.childbrowser" />

in the config.xml file

See this link

I did That and it is not working What am I missing here?

Thank you.

this is my code:

<!DOCTYPE HTML><html>
<head>
    <meta name = "viewport" content = "user-scalable=no,width=device-width" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <title>Test Page</title>
    <link rel="stylesheet" href="js/jquery.mobile-1.4.0/demos/css/themes/default/jquery.mobile-1.4.0.min.css">
    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script src="js/jquery.mobile-1.4.0/demos/js/jquery.js"></script>
    <script src="js/jquery.mobile-1.4.0/demos/js/jquery.mobile-1.4.0.min.js"></script>
    <script type="text/javascript" charset="utf-8">
        function init(){
            document.addEventListener("deviceready", ready, true);
        }
        function ready() {
            console.log("phonegap is ready !");
        }
    </script></head> <body onload="init();">
<div data-role="page" id="home">
    <div data-role="content">

        <a href="#" onClick="window.plugins.childBrowser.showWebPage('http://www.google.com')">Open link in child browser !</a>

    </div>

</div>

and this is my config.xml file

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns = "http://www.w3.org/ns/widgets"
    xmlns:gap = "http://phonegap.com/ns/1.0"
    id        = "il.co.app.chazak"
    versionCode="1.0"
    version   = "1.0">
    <preference name="phonegap-version" value="3.1.0" />
    <name>chazak</name>
    <description>Chazak book librery</description>
    <author href="http://www.shtibel.com" email="[email protected]">Dushy</author>
    <preference name="phonegap-version" value="2.9.0" />
    <preference name="orientation" value="default" />
    <preference name="target-device" value="universal" />
    <preference name="fullscreen" value="false" />
    <preference name="webviewbounce" value="true" />
    <preference name="prerendered-icon" value="true" />
    <preference name="stay-in-webview" value="true" />
    <preference name="ios-statusbarstyle" value="default" />
    <preference name="detect-data-types" value="true" />
    <preference name="exit-on-suspend" value="false" />
    <preference name="show-splash-screen-spinner" value="true" />
    <preference name="auto-hide-splash-screen" value="true" />
    <preference name="disable-cursor" value="true" />
    <preference name="android-minSdkVersion" value="7" />
    <preference name="android-maxSdkVersion" value="17" />
    <preference name="android-installLocation" value="auto" />
    <preference name="splash-screen-duration" value="0" />
    <preference name="load-url-timeout" value="0" />
    <feature name="http://api.phonegap.com/1.0/file"/>
    <feature name="http://api.phonegap.com/1.0/notification"/>
    <icon src="icon/iphone/Icon.png" gap:platform="ios" width="57" height="57" />
    <icon src="icon/iphone/Icon-72.png" gap:platform="ios" width="72" height="72" />
    <icon src="icon/iphone/Icon-2x.png" gap:platform="ios" width="114" height="114" />
    <icon src="icon/iphone/Icon-72-2x.png" gap:platform="ios" width="144" height="144" />
    <icon src="icon/android/ldpi.png" gap:platform="android" gap:density="ldpi" />
    <icon src="icon/android/mdpi.png" gap:platform="android" gap:density="mdpi" />
    <icon src="icon/android/hdpi.png" gap:platform="android" gap:density="hdpi" />
    <icon src="icon/android/xhdpi.png" gap:platform="android" gap:density="xhdpi" />
    <gap:splash src="splash/iphone/Default.png" width="320" height="480" />
    <gap:splash src="splash/iphone/Default-2x.png" width="640" height="960" />
    <gap:splash src="splash/iphone/Default-568h2x.png" width="640" height="1136" />
    <gap:splash src="splash/iphone/Default-Portrait.png" width="768" height="1024 " />
    <gap:splash src="splash/android/ldpi.png" gap:platform="android" gap:density="ldpi" />
    <gap:splash src="splash/android/mdpi.png" gap:platform="android" gap:density="mdpi" />
    <gap:splash src="splash/android/hdpi.png" gap:platform="android" gap:density="hdpi" />

    <gap:plugin name="com.phonegap.plugins.childbrowser" version="4.2.1" />

    <access origin="*" />
    <access uri="*" subdomains="true" />

</widget>
1
why don't you use inAppBrowser? it replaced childbrowser long time agojcesarmobile
Can you direct me to an example code?Dani Tami Dushinsky
Dose the inAppBrowser have an option to show the app header and footer and can it show PDF file?Dani Tami Dushinsky
I try the inAppBrowser but get this error on adobe phonegap build: plugin unsupported: org.apache.cordova.inappbrowserDani Tami Dushinsky
Now it works, but How can I show the App header / footer?Dani Tami Dushinsky

1 Answers

1
votes

you have to include the childbrowser.js script after cordova.js:

<script type="text/javascript" charset="utf-8" src="childbrowser.js"></script>

childbrowser plugin doc