HTML Page does not display images on Android Phone

Hello everybody!

I have been developing Websites for the desktop environment for years.
When I copied one folder of Web page on to my Android Phone, I noticed that everything is just fine, except the images.
Please find below just a simplest example:

<html>

<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample HTML document</title>
</head>

<body>

<h1>Sample HTML document</h1>
<p>HTML Contents are here.</p>
<p>HTML Contents are here.</p>
<p>HTML Contents are here.</p>
<p>Below is the image with the following code:</p>
<p><img src="img/Brain_NS.png"></p>
<img src="img/Brain_NS.png">
<p>&nbsp;</p>
<p>&nbsp;</p>

</body>

</html>

Can you clarify please?
Are you talking about viewing a page that is hosted somewhere on you phone?
Though it sounds like the html page file is actually on the phone and being viewed locally.

Thanks for your response.

I have just copied my HTML page from my local PC on to my two mobile phones. The page displays just normal on Android 5 based J2, but no reference seems working on the Android 6 based J7 phone.

<link href="myCSS.css" rel="stylesheet" type="text/css">
or
<img src="img/Brain_NS.png" alt="">

The html page shows without taking the CSS file or displaying any image.

Please suggest.

Regards,

Did you also copy the image file and css file to the phone?
You are using relative paths to those resources, so if they are not on the phone they will not be found.

Where is the image that you want to display? Check the path to that image. The code you show indicates that there is also an img folder containing the image.

Of course, I copied the whole folder, along with img folder residing in within the folder containing my HTML file.

The CSS file and the html page are in the same folder, but the images are in the img folder.
Also, the same html document shows perfect on my Android 5 J2 phone.

The problem seems a different way of referencing any supporting file under Android 6.

I jut like to add that, I am developing Websites for quite some time, but have never done on any portable device.

Regards

I suggest that you host your files online rather than trying to work out what local file system a mobile may or may not have.

You do not want to change anything just because your device does not support local files. in iOS for example you have no choice to develop locally on a device except on a simulator via a desktop.

You can do most of your device testing on a desktop anyway using the chrome devtools to emulate devices. Once you have something up and running then you can upload and then fine tune on the actual device.

4 Likes

Thanks, PaulOB for your attention.
However, it is very disappointing that; the user can not display his/her HTML contents without a hosting service. It also means that; the so called upgrade from Android ver 5 to ver 6 is actually a DOWNGRADE.

Regards

I don’t really understand your logic because no one will be able to view your website unless you host it!

Theres is no point in creating something just for your machine only and even if it is just for practice it needs to be in a format that will work on the web otherwise it’s a waste of time.

Mobile devices are not computers as such and not really designed to store html, images and js files etc ( at least not in the same way as a desktop system).

If you just want something for yourself only then it looks like you should probably create an app and not a website but that’s a whole different ballgame :slight_smile:

1 Like

I don’t have android but I’m guessing things have just been moved or permissions changed in the settings somewhere.

There seems to be quite a few articles on google about the android file system so you may have to dig further into the details if you go down this route.

However as I said above it’s a pointless exercise really and anyone designing a website should get hosting acess for proper testing.

1 Like

Well, there is always a reason behind an effort, and I am also trying to get something done. Every limitation or a restriction should not be justified but be condemned.

D[quote=“raabianony, post:11, topic:282169”]
Well, there is always a reason behind an effort,
[/quote]

True but that doesn’t stop it being a waste of time as far as serious and professional web design is concerned and you haven’t shared your reason so I can’t give you the benefit of the doubt.

As I said iOS has no file system so you can’t do this for iOS so it makes no sense to do it for only android unless of course this is just for you on your own device and no one else?

A quick search on google tells me that the android version you talk about does have a file system so I suggest you do a little more research as I don’t have an android handy to test. I’m guessing that no one here will ever have tried running code locally on a device for the reasons already mentioned either.

Yes I said that about seat-belts and motor cycle helmets :slight_smile:

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.