Question

I have tried everything possible to my understand and also calling the inappbrowser as esplained on the phonegap website, its working but i can't seem to get status bar displayed and it doesn't launch in fullscreen.

I have user the code below in my webpage tag.

<script type="text/javascript">
      function onDeviceReady() {
      var ref = window.open('http://www.bbc.co.uk', '_blank', 'location=yes');
     // close InAppBrowser after 5 seconds
       setTimeout(function() {
            ref.close();
            }, 5000);
        }            
</script>

Used the

onClick="onDeviceReady();

which is perfectly launching the inappbrowser. I have have done everything possible with my config.xml and please find code below

<preference name="phonegap-version" value="2.9.0" />
<preference name="permissions" value="none" />
<preference name="orientation" value="landscape" />
<preference name="target-device" value="tablet" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="false" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="false" />
<preference name="ios-statusbarstyle" value="black-opaque" />
<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="false" />
<preference name="load-url-timeout" value="15000" />
<preference name="FadeSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value=".25" />
<preference name="TopActivityIndicator" value="gray" />
<preference name="ShowSplashScreenSpinner" value="true" />

but nothing seem to bring up the browser's location bar. Been on this for 2days now and i have tested it on both the simulator and live device. the inappbrowser shows up but not in fullscreen and without the toolbar.

Any help will do and thanks in advance.

Was it helpful?

Solution

I have been able to backtrack the issue. Despite installing PhoneGap 3.0.0, I was at first confused why the phoneGap website will ask to include the <script src="cordova.js"></script>, I took it out and it worked perfectly and I also had to manually install the InAppBrowser plugin into my app dir using the phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git command after creating my app using create MyiPadApp com.example.MyiPadApp myApp and then all works perfectly.

Next is finding how to close the InAppBrowser from the child website. I have successfully injected a few lines of javascript code to monitor touch and click activities

var IDLE_TIMEOUT = 10;
var _idleSecondsCounter = 0;

document.ontouchstart = function() {
  _idleSecondsCounter = 0;
  };

document.ontouchmove = function() {
  _idleSecondsCounter = 0;
  };
window.setInterval(CheckIdleTime, 1000);

function CheckIdleTime() {_idleSecondsCounter++;

  var oPanel = document.getElementById('SecondsUntilExpire');
    if (oPanel)oPanel.innerHTML = (IDLE_TIMEOUT - _idleSecondsCounter) + '';
    if (_idleSecondsCounter >= IDLE_TIMEOUT) {
         alert('InAppBrowser will now close!');
         //I will need to add the ref.close() but it's not working.
         }
}

Alert comes up but .close() isn't working cos its not returning value to the InAppBrowser Any help please

OTHER TIPS

Instead of using the "InAppBrowser" plugin from Phonegap, you can use the ChildBrowser plugin in the link https://github.com/phonegap/phonegap-plugins/tree/master/iOS/ChildBrowser

I have tried using "InAppBrowser" before but i was not happy with it as it didn't provide the necessary funcationality for me like onLocationChange events etc and there were issues using it. So i always use the ChildBrowser plugin.

Hope this helps!!!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top