Deutsch   English   Français   Italiano  
<lghvhuFpls7U4@mid.individual.net>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Arno Welzel <usenet@arnowelzel.de>
Newsgroups: comp.mobile.android
Subject: Re: viewing local htm files on Android device
Date: Fri, 26 Jul 2024 18:01:03 +0200
Lines: 55
Message-ID: <lghvhuFpls7U4@mid.individual.net>
References: <v7nf7c$g03g$1@paganini.bofh.team>
 <lgfov6FdmbdU4@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: individual.net +tR31rlZHYOh2ifo8kP53ALoWkTkM40jLq0g0i+l3U77lyYdvo
Cancel-Lock: sha1:ekHPHhAfcxROeXM5XZn1oV41L14= sha256:/4IsnI+P4UxQlyRKHCqfew92YGaqB+iTB0M4Miq6mTk=
Content-Language: de-DE
In-Reply-To: <lgfov6FdmbdU4@mid.individual.net>
Bytes: 3220

Carlos E. R., 2024-07-25 21:56:

> On 2024-07-23 07:31, Malone wrote:
>>
>> I've created a simple (just text, no script) .htm file on a Windows 
>> computer ("testhtm.htm") and transferred it to my Android tablet.
>>
>> In My Files - Downloads it then appears as "testhtm.htm". Tapping it and 
>> it opens with Chrome (my default browser) as 
>> "content:media/external/file/1000000383".
>>
>> Long tap and select "Add to Home Screen" and an icon appears on the home 
>> screen titled "testhtm". And when tapping this it opens in Chrome.
>>
>> If I now restart (reboot) the tablet and try to open the file by tapping 
>> its icon on the home page it doesn't open and I receive the message: 
>> "Chrome does not have access to the requested resource."
>>
>> If I then go to My Files - Downloads I find I can open it from there. 
>> And if I then go back to the home page it will now open from there as well.
>>
>> Why is this?
> 
> I seem to recall old bug aka feature that file:/// would not work in 
> Android. Re firefox, probably.

No, there is no global "file:///" mechanism in current Android versions
for security reasons. The only files an app can access are the files
within the app sandbox but nowhere else. Direct file access was
discouraged in Android 4.4 and the use of the Storage Access Framework
instead if direct file access is mandatory since Android 7.

An app only sees URIs which *may* be connected to a file or folder on
the device, but technically it is just a handle to some kind of data and
which is provided by a storage provider. Apps like Google Drive,
OneDrive, Nextclud etc. install storage providers which allow to access
files on a server which don't have to stay on the device and will only
get downloaded if needed.

In addition, an app has to request permission for *every* URI it wants
to access. This permission can be granted temporary (only lasting until
the app is terminated or the device is rebootet) or it can be
persistent, so the app has only to ask once and the permission will last
as long as the app is installed on the device.

So a browser could implement some mechanism to use the Storage Access
Framework to open a "file" instead of a website and also ask to get a
persistent permission for this - but I don't know any browser which
implemented a "open a file using the storage access framework" feature.


-- 
Arno Welzel
https://arnowelzel.de