Search code examples
cordovacordova-3

Which are the use of other index.html in a PhoneGap app?


After I created a PhoneGap and add two platforms:

$ cordova create test com.example.test Test
$ cd test
$ cordova platform add ios
$ cordova platform add android    
$ cordova platform list 
Installed platforms: android 3.5.0, ios 3.5.0
Available platforms: amazon-fireos, blackberry10, firefoxos

There are 3 index.html files:

$ find . -name index.html 
./platforms/android/assets/www/index.html
./platforms/ios/www/index.html
./www/index.html

The ./www/index.html is loaded when running iOS simulator:

cordova emulate ios

What are the use of:

./platforms/android/assets/www/index.html
./platforms/ios/www/index.html

Solution

  • The www/index.html is copied to the other platforms on a cordova build <platform>. The copying actually takes places on cordova prepare <platform>

    Note: you can also create a index.html in merges/ios/index.html where you can differentiate between a file for different platforms. of course this also works with other files then index.html.