简体   繁体   中英

Cordova - how to read and write s file in the web application folder

I am with Cordova and JQuery to build an Android App.

I have a json file in /www/data/my file.json, and I need to read this file into front end index.html on the device ready event, also to overwrite this file as well from a button click as well.

Can anyone point me a direction what object of the Cordova file plugin I should use? An example would be really appreciated.

The direction is the cordova-plugin-file , but good luck modifying files from the app package, which is impossible as far as I know... no app cannot rewrite itself that way.

To keep small JSON data, you should use localStorage , this is the easiest way and it does not require plugins. Refer to the localStorage limits before though.

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