Accessing external website from PhoneGap application

I wanted to create a PhoneGap application, which instead of pointing to a HTML page inside the application should open my blog site these are the steps that i followed to build the application, you can download it from here
  • I followed the instructions in Getting Started with Android to build application that points to index.html inside the application, i tried it once to make sure that it works
  • Then i changed the HelloCordovaActivity like this so that it points to
    package com.webspherenotes.cordova.sample;
    import org.apache.cordova.DroidGap;
    import android.os.Bundle;
    public class HelloCordovaActivity extends DroidGap {
        /** Called when the activity is first created. */
        public void onCreate(Bundle savedInstanceState) {
    The onCreate() method is calling super.loadUrl(""); so that page is opened in the WebView as soon as application starts
  • The default configuration of the PhoneGap application disallows opening of any external URL so i had to change the cordova.xml like this to allow access to
    <?xml version="1.0" encoding="utf-8"?>
     access elements control the Android whitelist.  
     Domains are assumed blocked unless set otherwise
        <access origin="*"/> <!-- allow local pages -->
     <access origin="" />
     <!-- <access origin="" /> 
     allow any secure requests to -->
     <!-- <access origin="" subdomains="true" /> 
     such as above, but including subdomains, such as www -->
     <!--  <access origin=".*"/>   
     Allow all domains, suggested development use only -->
        <log level="DEBUG"/>
        <preference name="classicRender" value="true" />
    Take a look at XML comments in this file for syntax on how to allow access to external URLs
Now the application is ready and when i launch it i can see my blog being opened like this


Tuấn Hoàng Anh said...

why "" error "Description Resource Path Location Type Attribute is missing the Android namespace prefix"

Bangalore Web Guru said...

I am a regular user of your post, this one also was very interesting and well written. keep sharing the great work Web Design Agency in Bangalore | Website Developers in Bangalore