Note that there are some explanatory texts on larger screens.

plurals
  1. POPhonegap Android read file on sdcard with JavaScript
    text
    copied!<p>I am trying to read a text file with JavaScript using Phonegap 2.0.0 on Android. I went over several examples using the File API at <a href="http://docs.phonegap.com/en/2.0.0/cordova_file_file.md.html#File" rel="nofollow noreferrer">http://docs.phonegap.com/en/2.0.0/cordova_file_file.md.html#File</a> Nothing seems to work.</p> <p>I read several related threads on Stackoverflow, for example: </p> <p><a href="https://stackoverflow.com/questions/8952950/how-to-read-file-in-android-using-phonegap-javascript">How to read file in android using PhoneGap Javascript</a></p> <p><a href="https://stackoverflow.com/questions/11145614/android-html5-fileapi-can-i-read-file-from-sd-card">Android HTML5 FileApi can i read file from SD Card?</a></p> <p>and <a href="https://stackoverflow.com/questions/11207099/how-to-create-a-new-file">How to create a new file</a> among others. Yet none of the techniques seem to work.</p> <p>I am using Nexus One with API 8. The android app loads a URL: <a href="http://www.mydomain.com/read_text_file.html" rel="nofollow noreferrer">http://www.mydomain.com/read_text_file.html</a> which contains the JavaScript utilizing the PhoneGap framework. I am trying to access a file on the SD card located at: <code>/sdcard/textfile.txt</code>. I specify the path to the file in the JavaScript as: <code>file:///sdcard/textfile.txt</code></p> <p>For the time being my goal is to trigger an alert from the JavaScript upon page load and show the file contents ( which is just "test file" )</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload