简体   繁体   中英

What should I do to build an offline web-based Phonegap app using http in loadUrl

I use HTML5, CSS3 and JS in my Phonegap Android project. In MainActivity.java I use:

super.loadUrl("file:///android_asset/www/index.html");

The JS functions do not work. However, when I host the web site and use:

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

They work well.

I was asked to build an offline app, so I don't know what I should do to solve this problem. I need helps, please.

You can add this property to config.xml

<content src="index.html" />

and then

super.loadUrl(Config.getStartUrl());

Actually the default setting of PhoneGap should work without extra setting on Java.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM