Search code examples
androidcordovaphonegap-pluginsphonegap-buildcordova-plugins

Phonegap application crashes while trying to access one page which is not in the same directory


I have two links in an application the fist one as below and it's working fine:-

<a href="login.html"><img src="images/en.png" width="30" height="30" >English</a>

The second one is as below with the error There was a network error. (file:///android_asset/www/login.html) :-

<a href="../login.html"><img src="images/en.png" width="30" height="30" >English</a>

which means that the application crashes while trying to access html file which is not located in the same directory. Any Idea Please


Solution

  • The path should be set as absolute path as below:-

    file:///android_asset/www/login.html
    

    But this requires to set a condition case for the used platform as the above will not work with iOS. To short it cut and only if you are developing a small application, drop your files in one location and set a relative path.

    Another Advice, I found that XDK is better than Phonegap. Intel is rock!

    Thanks!