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("http://example.com") >= 0)
        {
          window.plugins.childBrowser.close();
        }

Here when the browser the detects page url is 'example.com', 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:

Technical Support:

If you still face the technical problem, please get support of our highly skilled technical team: garazlab.com.


Wordpress Plugins:
  1. Real-Time Health Data from Every Where:WP plugin to display real-time health data & increase sale by promoting user specific products according to health information: garazlab.com.
  2. Woocommerce Stock Notification Builder:Sends desktop, mobile & email notifications with full customization.Build your own product notification system with it: garazlab.com.

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

3 comments:

Unknown 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 :-)

Unknown said...

Hey Ewald,

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

window.plugins.childBrowser.close();

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!!