1. Support Reading Slices of Text Files.
The File object now has a slice method. Suppose the file we're reading contains the text:
"All that is gold does not glitter, not all those who wander are lost."
Then...
- f.slice(4, 8) would result in "that"
- f.slice(9) would be "is gold does not glitter, not all those who wander are lost."
- f.slice(-5, -1) would be "lost"
2. Added input type=file support
Now if you specify an input field of type file you will get a "Choose File" button:
Then when you click the button you will launch an intent that can handle file picking:
Now the value of your input tag will be the file you selected.
3. Additional preferences in config.xml
I completely missed this one so Joe Bowser wrote it up.
Hello Simon,
ReplyDeleteI am using cordova 2.4.0. I am trying open pdf/ppt/doc files that are stored in my Android phone filesystem through a phonegap application using the InAppBrowser, but no success there. Is it actually possible to do it this way?
The code line I use for this is:
window.open('file:///mnt/sdcard/file.pdf','_blank','location=yes');
Any suggestions of how to do this?
Thank you in advance.
BR,
Gjoko
hi, Android Back button not working when we open INAppBrowser in Android ICS tablet...
ReplyDeletePlz help me
@arjun t raj
ReplyDeleteReproduction scenario?
@Gjoko Grkov
ReplyDeleteTry using:
window.open('file:///mnt/sdcard/file.pdf','_system');
instead. The InAppBrowser doesn't have the facility to view PDF files.
Hello Simon
ReplyDeleteThank you for your reply.
I tried what you suggested but I received this error message:
No Activity found to handle Intent
{act=android.intent.action.VIEW dat=file:///mnt/sdcard/file.pdf}
Do I need to change or add something in the ActivityManifest.xml ?
PS: I am also trying to open ppt files as well.
@Gjoko Grkov
ReplyDeleteYou need to have apps installed that can handle that mime type and are registered to view them.
Hi Simon,
ReplyDeleteThanks for adding the file input feature.
Is there a way for this to respect the "accept" attribute?
input id="photo-load" type="file" accept="image/jpeg" capture="camera"
The intent that is fired seems to be a generic file intent and ignores the mime type specified.
I also noticed that cordova does not provide the camera as an option for file input. Is there a way to get around that without using the camera plugin?
Thanks!
@Arvind Menon
ReplyDeleteNot yet, hoping to some good news with the Google IO going on right now.
Hi Simon,
ReplyDeleteI think the input type=file support is broken on android 4.4.
Can you check it?
@jcaesar
ReplyDeleteYes, definitely broken with the new Chromium WebView.
https://issues.apache.org/jira/browse/CB-5294