3

I have an .htm file in a dropbox folder with the following content:

<p>this is a <b>test</b> of html</p>
<img src="test.png"/>

When I view it on my PC, it shows the image (which is in the same directory as the htm file).

However, when I view it on my HTC Wildfire and choose as the viewing application "HTMLViewer", it shows me the correct HTML rendering (with bold) but shows me a broken image.

How can I view HTML files with image tags in my dropbox folder on my Android phone?

5
  • 1
    Similar problems has been reported (though it is 1 year old). I'm guessing the issue is with the app. Doesn't your default android browser open HTML files ? Aug 12, 2011 at 16:00
  • 4
    Is the image actually on your device? The Dropbox app doesn't automatically download files to your phone, it just lists the files on your account. You need to open a file (or long-press and hit download) to actually get it on your device. I tested this and as long as I download the image first it works fine. If you enable the file status icons in the Dropbox settings anything without a green check has not actually been downloaded to your phone yet. Aug 12, 2011 at 16:21
  • @eldarerathis that was a good idea, but even after loading the image onto my phone the html page still shows it is broken, as if there is something wrong with the path, i.e. as if there is an absolute path, strange. Aug 15, 2011 at 20:33
  • @CustomiZer when I hold my finger down on index.htm, then choose open, it gives me the choice between (1) Text Editor DB, (2) HTMLViewer, (3) HTML Visualizer DB. How do I tell it to "use the Android browser?" Aug 15, 2011 at 20:36
  • I did some testing on different handsets and discovered that some like mine allow opening of htm file using default browser (dropbox not installed) and some gave an option like text, HTML viewer. I'm not really able to understand the cause of the problem. Try some other webpage and check if you still get the broken images. Aug 15, 2011 at 20:57

2 Answers 2

1

I have DropBox installed on my Moto DROID v1 (Android OS 2.2.2). I placed an HTML file that referenced an image in a DropBox folder. The image was in a sub-folder.

  • DropBox\Folder\index.html
  • DropBox\Folder\img\image.jpg

I first downloaded just the index.html and opened it in the HTMLViewer. The image link is broken. I then downloaded the image.jpg file, then returned to index.html and viewed in HTMLViewer. The image now appears properly.

I'm not sure if it has anything to do with it, but you may want to try switching your file extension to .html, and verify that the doctype of your file is set properly:

<!DOCTYPE html>
1

The Dropbox app for Android doesn't save files to a "folder" like the PC version does. Android has stronger security and doesn't let apps access other apps' files, so even if it did do that, the browser wouldn't be able to read the image.

When you choose to open a file that's listed in Dropbox, the Dropbox app creates a special URI that points to that one file. It uses an intent to start an activity to view that URI, and sets a special flag to say that the new activity (in this case, the web browser) has permission to access only that URI. That means that there's no path you can put in the HTML file that lets the browser read the image: it has Dropbox's permission to read only the file you clicked on.

If you want to have a directory of HTML files and images that all load in the browser, you need to store it on the SD card (rather than in one app's data) where any app can read and write any file. I don't believe the Dropbox app has the feature of being able to sync directories on the SD card, but you could use another app to achieve that. For example, you could use an FTP client to sync the directory with one on an FTP server.

The answers to this question have lots of suggestions for how to keep directories in sync with Dropbox or another server.

You must log in to answer this question.

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