34

I want to open local files that are on my sdcard in the Android browser. How can I accomplish this?

3
  • 2
    This is pretty close to a duplicate...Open HTML file from SD card Commented Apr 14, 2011 at 23:55
  • Sorry my search didn't catch that one. Yeah its pretty close - although I'm asking for more than just HTML files.
    – Daniel
    Commented Apr 15, 2011 at 0:02
  • I probably wouldn't vote to close this (if I had 3k), but now the other one shows up in the "Linked" area. I think I might go back and leave a comment on the other one so that searchers will get links both ways. These seem to get hits for very different search terms. Edit: Hm, the "Linked" section already links both ways, but I'll add a comment on the old one since it would be more visible... Commented Apr 15, 2011 at 0:05

4 Answers 4

20

In order to view local files on the sdcard with the default Android browser just enter file://sdcard/ and then the path to the file you want to view. For example if you have an xml file named "person" in a folder named "xmlfiles" it would look like file://sdcard/xmlfiles/person.xml in your address bar. You can create bookmarks for the file you are viewing but if you try to make a shortcut to that bookmark or use a bookmark widget (at least the HTC one) these will not work and may give an error "The linked program is no longer installed on your phone". The bookmarks will work if opened from within the browser.

So far I have verified that the browswer can open/render these files: xml, html files(htm), and image files

It cannot open pdfs.

According to this comment it works for Android 2.1 and above

2
  • This doesn't work for me with directories (so I can browse the file system rather than typing a lot): "The web page at file://sdcard/download could not be loaded as: Is a directory". Can that also be made to work somehow?
    – nealmcb
    Commented Aug 19, 2011 at 5:13
  • 1
    what path must one use for internal storage?? Commented Feb 3, 2017 at 10:59
4

Found a solution for the local file browser problem on my Xoom tablet

I tried opening a local file with Opera by typing file:///mnt/sdcard/Documents/blabla.html. Opera changed the adress in file://localhost/mnt/Documents... Using the localhost syntax on the android browser opened the local file.

3

The answer is here already, but I am adding my 2 cents worth. I am using the Galaxy Tab S 10.5 and for me "file://localhost/sdcard" works in the Chrome browser on Android that comes with this device. I thought that sdcard would refer to an external media device that you can plug in, but it turns out that the sdcard in this URI refers to the built-in memory of the device. I wanted to test some DIY wireframes (with JavaScript, XHTML and CSS) and they work once I enabled JavaScript for Chrome.

0

You can browse the file system with Firefox for Android

5
  • 3
    In case anyone wants to try this, it's not obvious how to do it as there doesn't seem to be any option or button that lets you do it. If you select the address box at the top of the windows and type in file:// and then press enter you should see a file listing that lets you browse into directories and click on the files to view them.
    – GAThrawn
    Commented Sep 5, 2011 at 19:58
  • 2
    @GAThrawn "ERR_ACCESS_DENIED"
    – Spook
    Commented Jul 22, 2014 at 21:23
  • @Spook I thought that it was possible that things had changed in the 3 years since I wrote that comment, but no. I just tried it on my Nexus 5 (Android 4.4.4) and my Xoom (4.1.2), both running Firefox 31, and it works in both. Firefox does change ‘file://’ to ‘file:///’ but that's the only difference from my comment above.
    – GAThrawn
    Commented Jul 24, 2014 at 22:38
  • @GAThrawn Then it seems to be a problem with Samsung Galaxy devices. Tried on S4 and 10.1 2014 and got the same results :(
    – Spook
    Commented Jul 25, 2014 at 10:35
  • @GAThrawn on an Galaxy S5, Android 6.x, Chrome - file://localhost/storage/emulated/0/Download give a directory listing (and sub folders) but I could not find another folder that is viewable outside of that base folder. Galaxy S4 + Android 5.x + Chrome was like that too.
    – Scott R
    Commented Sep 20, 2020 at 16:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .