Sunday, April 22, 2012

How to close Child browser in iPhone phonegap?

Here we will see how we can close the child browser in iPhone phone gap automatically. There is a function in the child browser plugin named 'onLocationChange', which triggers when a the page url has been changed. we can detect this using the following code:
window.plugins.childBrowser.onLocationChange = function(loc){
        if (loc.indexOf("") >= 0)

Here when the browser the detects page url is '', then it closes the child browser.

See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide

List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide


Ewald Bos said...

can you maybe help me with something?

I open the childbrowser full screen and on the webpage (it's mine) there is a home button.

If i click the home button on the webpage i would like to close the window, what do i need to add to the page to close the webpage to make that work?

Thanks Ewald,
ps. this one very functional :-)

tahsin hasan said...

Hey Ewald,

Plz use the below code on the click event of the home button:


Daniel said...

hello, i have a problem of perfomance, i am using jquery and phone in my web app, my html pages are independent, and when I make the transition between pages they occupy a lot of memory, open each html phonepag different browsers? is there any solution to this?. greetings from Argentina!!