Off topic html and Android 10

Sorry for this off-topic question but I know there is a lot of knowledge here (and, of course, I did'nt get anything on Google).

I have a local html file on my SD card (say page1.html) which is calling another one (page2.html) via a simple link (Page2)
Both files are in the same directory (/sdcard/genealogie)
The fist one is correctly displayed but when I click on page2 link, the browser (Chrome) says 'ERR_FILE_NOT_FOUND'

Depending on which applcation I start the first one, paths are différent:
With local folders app, I get for page1.html:
The first one: "content://0@media/external/file/3393"
and the second (shown in the address bar) "content://0@media/external/file/Page2.html" but not found.
And if I type "content://0@media/external/file/Page1.html" it say file not found (same error then with Page2)

Hope I clear enough.
I Know this is because of recent security changes on Android 10 (was perfectly working for years before) but I wonder how I can make it work?

Any ideas?

Any reason you are not using the webviewer?

How are you opening the first html file, with activity Starter?

There is a block (.GetUri) in Taifun's File Extension that converts a normal file path to a content uri. Have you tried that? (put in first html file as the link)

Thank you TIM for your answer despite it's "off topic".
The thing is: I don't use AI2 at all; All .html files are on my SD card in one directory and I use Chrome to open the index file there (same with built-in viewer).
The file opens nice and clean but all the links (to other local files) results in "file not found".
Links are in the form: <a href="file2.html">237</a> with no preceding path.

I can see the first file has the form 'content://0@media/external/file/3393'
And when I click, it becomes: 'content://0@media/external/file/237.html'.
Any ideas ?

1 Like

What path do you use to open the "index" file?

You will probably need the same path/s in your html for the other files?

I just go with my brower ('My files') where the index is and click on the index.html file.
I can see the first file has the form 'content://0@media/external/file/3393'
And when I click, it becomes: 'content://0@media/external/file/237.html'.
Any ideas ?

You may possibly need to move the html files into one of the "media" folders, like Documents or Downloads.

I am am just doing some testing too.

OK
On android 10

I uploaded page1 and page2 html files to /sdcard/Download

Opened up page1.html in the browser using:

file:///sdcard/Download/page1.html

The file path to page2.html was simply that - e.g.

<body>
	<p>Hello this is page 1</p>
	<a href="page2.html">Open Page 2</a>
</body>

The same for page 2

<body>
	<p>Hello this is page 2</p>
	<a href="page1.html">Open Page 1</a>
</body>

and it worked

Not working on my Android 11 device....

I'll try that right now but I have to move the whole folder in Download as it has over 1,000 files in it.

That's right. It used to work nicely before!

You may have to install an http server....

I already read that somewhere else but I did not see why this. It's obviouly a misfunctionning in Android 11 (imo).

Thank you anyway :slight_smile:

Requires a simple AI2 app with a webviewer but then all that is needed:

and relative file paths work OK

Tested Android 10 & 11 with companion. Also works with files in Assets (http://localhost/....)

Whaou ! I'll try that soon.

I tried it on internal storage and I got:
"The permission READ_EXTERNAL_STORAGE had been denied; Please enable this in the settings of the app." (event it's on the phone's memory)
Therefore I used:


But no change (does not ask for anything)

I'd like to have it on external storage (SD Card) but I'm unable to get the corresponding path!

I also tried with:

But same message

see here:

https://community.appinventor.mit.edu/t/how-can-i-import-mp3-files-onto-a-list-automaticlly/38756/7

You may have to manually give your compiled app permission (Storage / Media and Files )

Ok, When I use my numbers (3135-3361) it gives me
net: ERR_ACCESS_DENIED