7

My Android PhoneGap application works completelly as expected when I copy all the web files (html, JS, CSS...) to the www folder of the project, and compile the application with these files. But when I do not copy them, and make a redirection to my Web Server containing these files (i.e. in the WWW folder there is only one file: index.html with a redirection to my server) phonegap does not work in the application anymore.

Is there a way to get phonegap to work, when the application content files are delivered by a remote server and not compiled with the application?

Gajotres
  • 57,309
  • 16
  • 102
  • 130
jcdmb
  • 3,016
  • 5
  • 38
  • 53

1 Answers1

6

It can be done. Nothing can prevent you from doing that.

Phonegap + Android :

In your main activity class, method onCreate change loadUrl to:

super.loadUrl("http://.../index.html");

iPhone + Phonegap ia another story, still it can be done. Because there's a lot of changes here's a tutorial: http://www.joeldare.com/wiki/open_a_url_in_phonegap

One more thing, you must enable internet connection for Phonegap.

As you are using the android platform add this line to your AndroidManifest:

<uses-permission android:name="android.permission.INTERNET" />

Ah, one more thing, a viewport meta tag must be set in your html file.

Gajotres
  • 57,309
  • 16
  • 102
  • 130
  • 1
    I tried it and the phonegap didn't open the desired url at start but rather started the browser to open the url. So is there other steps to enable internal redirecting? – SolessChong May 28 '13 at 13:45