0

i want to Build Android Apps with HTML, CSS, and JavaScript. I need to read file. A local file that contain questions (A data base of question). i think it is possible with javaScript , is it true? please help and share your information. Thanks in advance

1

1 Answer 1

1

Yes, using HTML5 FileReader API. The best source for that is , http://www.html5rocks.com/en/tutorials/file/dndfiles/.

Scroll down to reading files.

FileReader.readAsText(Blob|File, opt_encoding)

Split the content with EOL character for UTF-8.

Note: By default the string is decoded as 'UTF-8'.

Sign up to request clarification or add additional context in comments.

5 Comments

thanks , can i get a static path file to this function , i have a data base store in a file and I want to read this data base so it's path is specified. can i load this file automatically? thanks for your answer
I dont think its possible to access local hard disk. JavaScript doesnt have access.
You can run a local server on your computer and put those files in it. Access it from there.
every thing is static, i mean i don't want to connect to server.i am just using html,jS & css that can be run on mobile like games that every body install on mobile without need to use internet. sorry for my pure English , i hope understand my mean :(
You can store and retrieve data using localstorage. html5rocks.com/en/tutorials/file/filesystem . But you cannot access anything outside that :|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.