Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

How can I open an HTML file I have copied from PC to SD Card of Phone?

I've tried opening it with the default application which is HTML Viewer but I get a "Web page not available" system page. The URL that the browser shows is:

content://com.android.htmlfileprovider/mnt/sdcard/Documents/To%20Read.html?text/html

Any ideas?

Thanks.

share|improve this question
2  
Similar (newer) question that deals with some other filetypes as well: How can I can open local files in the default Android browser? –  eldarerathis Apr 15 '11 at 0:06

8 Answers 8

up vote 13 down vote accepted

You should be able to point the browser at the file you want with a URL of the format file:///path/to/file.html. For example, I just did this on my EVO with a file I saved to the root of my SD card as post.html by launching the browser and entering the URL file:///sdcard/post.html.

Alternatively, my file manager lets me open an HTML file with "HTML Viewer". This is not as feature-rich, though, and didn't seem to render images for me (whereas the browser way loaded everything properly). My file manager does not give me the option to open the file with the browser, or either of the other browsers I have (Firefox and Opera Mobile).

share|improve this answer
    
Excellent, thank you! It seems to work with just file:// (only 2 forward slashes) as well. Also, you are right, it's HTMLViewer software that opens it from the file browser app, not the real browser. Android should give you the option to open HTML files and such using any installed browser, hopefully in the future. –  Francisc Jan 16 '11 at 19:09
    
I am trying the same with opera.It is asking me not able to connect, check network settings. :( –  articlestack Sep 23 '11 at 11:13

Just rename the file by appendinh ".html" to it. For example, if the file name is "abcd", rename it to abcd.hmtl. This works for me in android 2.3.

share|improve this answer

A few people allude to the issue of having spaces in the file name. I will clarify.

Android is based on Linux, and therefore uses a posix file system. This means that file names with spaces cause issues. Don't use spaces if you are creating a file or directory; leave them out or use periods (.), dashes (-), or underscores (_). To load an existing file with space in it, you must quote the file.

Using the example from the question replace:

content://com.android.htmlfileprovider/mnt/sdcard/Documents/To%20Read.html?text/html

with this:

content://com.android.htmlfileprovider/mnt/sdcard/Documents/"To Read.html"?text/html

If you are otherwise simply opening a file, you may quote the whole string. Like this:

"/mnt/sdcard/Documents/To Read.html"

In addition to spaces which can cause problems, posix systems permit characters in file names that are not permitted in Windows. To avoid issues when copying files between systems, even though some are still permitted on Windows as well, do not include the following characters in file names: / \ ? * : % " < > | + # '

To avoid further problems use a consistent style of capitalization in file names. Note that posix systems are case sensitive, which means file names are case sensitive. This means that file.txt, FILE.TXT, file.TXT, File.txt, georgE.txt, etc. are all different files on a posix system, while they are considered the same file on Windows.

share|improve this answer

Download the Android App from here - Google Play Store - OpenHTML

share|improve this answer
1  
Can you elaborate a bit? –  Al E. Feb 2 '13 at 16:22
    
Simple and elegant solution. –  Juanin Oct 9 '13 at 20:51

because default HTML viewer is used then no space between the filename e.g "about us.html " is incorrect. rename as "aboutus.html " it will now open

share|improve this answer
1  
This answer already has been given. –  Izzy Nov 20 '12 at 19:24

On my Droid 4 (ICS) from VERIZON I get the browser's address box and type:

/mnt/sdcard-ext/my_page/index.html

Then set it as a bookmark. I use Chrome, not sure if I can set it as a home page like on my PC. This is on my SD card in a folder with lotsa pix.

To hide the pix from cluttering up your gallery, give the directory a period in front of it like /.my_page/. Use root explorer or a terminal emulator to check the location.

I think mnt/sdcard/ may point to device internal storage.

share|improve this answer
1  
instead of hiding the directory (naming it .my_page), you can simply put an empty file named .nomedia into the directory -- with the advantage to easier find your directory (as it is not hidden), while still not "cluttering up your gallery". Media scanner skips all directories having this file inside. –  Izzy Aug 31 '12 at 11:23

If your file is at /mnt/sdcard/test/file.html you can access it through the browser from using:

content://com.android.htmlfileprovider/sdcard/test/file.html

Note:

Your file location should not contain any spaces i.e. /mnt/sdcard/test location/file.html doesn't work, even if the URL replaces it with %20.

Additionally, bookmarking the URL helps!

share|improve this answer
    
The content:// URL just redirects me to a google search. –  Jack M Oct 21 '13 at 10:37

Just type file://localhost/

It works in Opera Mobile.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.