Our Halloween Writing Contest is coming up soon. Start Writing! [ Dismiss ]
Home ยป Forum ยป Author Hangout

Forum: Author Hangout

Help with Android Device please.

Ernest Bywater ๐Ÿšซ

Can anyone who knows how Android devices work explain why the following code used to work in FireFox on Android 5 but doesn't work on Android 9 or Android 8 in any of FireFox, Opera, Chrome, Android HTML Viewer. More importantly, can you tell me what I can do to make it work so I can read html files on the local file system.

Below is standard HTML code that works in a PC browser as HTML 4, HTML 5, and XHTML but fails with error messages of "Cant find URL" or "No app to open that file." NB: Extra spaces added to stop the code running.

< p class = " center " > < img src = " .. / images / in_the_mail_900.jpg " width = " 900 " height = " 1350 " alt = " Cover " > < / p >

< p class = " center " > < img src = " in_the_mail_900.jpg " width = " 900 " height = " 1350 " alt = " Cover " > < / p >

In the code above the first references a file in another sub-folder within the same folder the html is in a sub-folder of, while the second is another file in the same folder as the web page the code is on.

................

Bonus points for anyone who can tell me how to assign file associations that does not require Android to recognise a program in a sub-app first. When I try the methods mentioned on the Android help pages they all require a sub-app to be recognizing the various apps but it only recognises Chrome and HTML Viewer for .htm and .html file associations despite FireFox being on the device.

.......................

I dropped my old Android 5 device one too many times and its ghost is now freely wandering the universe. My New Lenovo M7 Tab uses Android 9 and is OK except it's totally useless for my intended purpose of reading htm and html files from the SD Card in it which I use for offline story reading.

Lazeez Jiddan (Webmaster)
Updated:

@Ernest Bywater

< p class = " center " > < img src = " .. / images / in_the_mail_900.jpg " width = " 900 " height = " 1350 " alt = " Cover " > < / p >

< p class = " center " > < img src = " in_the_mail_900.jpg " width = " 900 " height = " 1350 " alt = " Cover " > < / p >

if the html engine in your new device is more strict than the older one and you're using xhtml declaration, then you need to add a space and a slash at the end of the img tag to close it. That's the xml syntax used for xhtml.

< p class="center">< img src="../images/in_the_mail_900.jpg" width="900" height="1350" alt="Cover" />< /p>

< p class="center">< img src="in_the_mail_900.jpg" width="900" height="1350" alt="Cover" />< /p>

Also, if the 'images' folder resides in the same main folder as the .xhtml file, the first line would be:

< p class="center">< img src ="images/in_the_mail_900.jpg" width="900" height ="1350" alt ="Cover" />< /p>

by the way, for the forum, you only need to add a space before the opening bracket to stop the code from being interpreted.

Replies:   Keet  Ernest Bywater
Keet ๐Ÿšซ
Updated:

@Lazeez Jiddan (Webmaster)

by the way, for the forum, you only need to add a space before the opening bracket to stop the code from being interpreted.

A block < code>..< /code> like the quote-block would be quite useful since it's needed quite often on the forum.

Ernest Bywater ๐Ÿšซ

@Lazeez Jiddan (Webmaster)

As soon as I hit the bed my mind locked on to trying this, so I did. using the / declaration at the end as suggested made no difference at all - still no processing of the code.

While adding test pages to the SD Card I included one with the bove code, the suggested code you had, and normal URL codes as well as some normal paragraph and format html code. Every thing worked except the code references for something outside of the page that was not a full internet standard URL starting with http or https - it's most annoying.

Keet ๐Ÿšซ

@Ernest Bywater

Any external CSS or JavaScript? If yes, does that load?
I'm not that familiar with Android but from what I read media (images, video) is moved to an assets directory and the html after rendering is referring to the media with an asset number. Not sure if that is the problem but looking at the html code in the development (debug) console (F12) could give some insight in what is happening, maybe even mark the error and give a reason.

Replies:   Ernest Bywater
Ernest Bywater ๐Ÿšซ

@Keet

Any external CSS or JavaScript?

no external CSS or Java in the file. While there is some internal CSS code in the file everything is either in the html file or in the directory the file is in or in a sub-directory of the same directory the file's directory is in - it depends on the code format. All is standard html design layout and code that's been the case for over 20 years. - I get the impression Android refuses to accept a URL link that does not start with http or https.

The Tablet does not have a F12 button so I can't do that. I do have full access to the code itself and it all works properly on a normal PC - just not on Android.

Replies:   Keet
Keet ๐Ÿšซ

@Ernest Bywater

accept a URL link that does not start with http or https.

I don't think it's necessarily http/https but it probably is a security problem which Google has changed starting with Android Pie (9). Look up 'cleartextTrafficPermitted', maybe that gives some options to test.
By-the-way, apparently Firefox for Android doesn't have a debug console but you must use remote debugging instead. I don't think you want to go that far ;)

Ernest Bywater ๐Ÿšซ

@Keet


I don't think it's necessarily http/https but it probably is a security problem which Google has changed starting with Android Pie (9).

I'll look up the issue you raise, but it's an issue on my son's Android 8 tablet and another we checked which is Android 6. It affects FireFox, Opera, Chrome, and Android HTML Viewer the same way. Which is why I think it's an Android issue and not a browser issue.

Ernest Bywater ๐Ÿšซ

@Keet

cleartextTrafficPermitted

While it may be possible for developers working on the server side apps to work in that area, those config files are not accessible to the user in any way.

Lazeez Jiddan (Webmaster)

@Ernest Bywater

Every thing worked except the code references for something outside of the page that was not a full internet standard URL starting with http or https - it's most annoying.

Sounds like some security setting in the browser for local files.

Replies:   Ernest Bywater
Ernest Bywater ๐Ÿšซ

@Lazeez Jiddan (Webmaster)

Sounds like some security setting in the browser for local files.

There doesn't appear to be any beyond 3rd party cookies which I enabled to allow just in case that was the issue.

Ernest Bywater ๐Ÿšซ

Thanks for that, Lazeez, but I doubt it's the issue, although I will try it.

The code, as is in the relative file system variant is what i sue to make the e-pubs in Calibre and it works perfectly there. I'm about to get some sleep 00:47 here, then I'll emend a few files and copy them to the SD Card and see how they go in the morning.

hiltonls16 ๐Ÿšซ

Just a thought, probably you've already removed this possibility...

in the < head> section of the file is there a < base href="https://some.web.site/"> forcing relative location references to look outside for the files?

Replies:   Ernest Bywater
Ernest Bywater ๐Ÿšซ
Updated:

@hiltonls16

in the < head> section of the file is there a < base href="https://some.web.site/"> forcing relative location references to look outside for the files?

no. The file is done in a way to give maximum usage in html 4 and html 5 browsers. It's also the file I sue to make e-pubs, so the code within it is kept to the minimum to provide a good e-pub from the html as the code is also what's allowed in xhtml. The most complex is the inbuilt css code in the head section.

I tried with other web pages I have. Some of them are available on web sites as well as locally. When drawing the same type of code from a website it works ok, but not drawn locally from the sd card.

To double confirm I just accessed my own website from via the device. Go to it at www.bywater.net.au and it works and displays with the images being drawn properly from the sub-folder. Access the same initiating html file on the sd card (my home copy of the code on the web server) and I get all of the problems mentioned. Access the same file on my PC and it works exactly the same as if called over the internet.

Back to Top

Close
 

WARNING! ADULT CONTENT...

Storiesonline is for adult entertainment only. By accessing this site you declare that you are of legal age and that you agree with our Terms of Service and Privacy Policy.