Open local html files in Fenix
Why/User Benefit/User Problem
Users might want to open html files on Fenix in the mobile browser.
What/Requirements
- Handle the intent filters for filetypes
- Can talk to @snorp for any questions about Gecko
Acceptance Criteria (how do I know when I’m done?)
- [ ] can open a local html file without "unknown protocol error"
┆Issue is synchronized with this Jira Task
Does this mean https://github.com/mozilla-mobile/fenix/issues/4049 isn't won't fix anymore ? 😃
Hooray indeed, although sadly the direction Google has been moving in (apps should only use content://-URIs when launching other apps, meaning for us that you cannot open any of the other local resources possibly referenced by the HTML file pointed to by the received Intent, and now the deprecation of conventional file system access in Android 10 on top) is still endangering the long-term viability of being able to properly access local HTML files.
Browsing local files and opening HTML files works on my machine, with a small twist.
Write file:///storage/emulated/0/ on your address bar and notice the ///. If you don't write the /// your address bar will display it for you but it will show an error, even if you refresh the page. So make sure to have the /// on the first try, or else open a new tab.
Furthermore, once you have an HTML file opened, if you add it to your home screen, it won't be able to open it.
I use the lastest standard Firefox Preview from the Play Store on a Pixel 2 with Android 10.
Can anyone else confirm this behaviour on their device?
(Might be relevant for #4049 that is currently closed)
@rbrule Yes thank you! That URL works for me on the current stable 79.0.5 release (on Android 9). You just saved me from a very boring train ride with nothing to read. As a usability tip, after visiting file:///storage/emulated/0/ add it to the top sites so you can access it quickly and don't have to type the URL. It will show up as "Index of..." and icon only showing the letter "S".
I'm using this workaround for now, even though it is inconvenient that I cannot use my usual file manager app to browse. There are a lot of UX issues as well, e.g. the lock icon showing insecure connection and the file list clearly not being intended for touch use.
I've read through the associated bug reports and the upstream issues filed with Google and understand the difficulty. However, although it will fail to properly load local HTML files with local child content using the content:// scheme, Chrome still shows up as a viewer on Android for local HTML files and if the file has no child content it will load just fine. Since FF 80 on Android, FF doesn't even show up as a viewer. The content scheme was supported before, following https://bugzilla.mozilla.org/show_bug.cgi?id=1406903. Could we please have what we had before?
This could be reconsidered in the future but for now Fenix will not support loading file:// anymore.
Let's keep this feature request open to reconsider the opportunity of this later.
I would like too this feature.
This could be reconsidered in the future but for now Fenix will not support loading
file://anymore.
Fenix was released long before it had feature parity with Fennec. It still doesn't, several releases later.
There are outstanding bugs in fundamental, basic browser functions like, say, downloading -- look at the list of issues there, I'm hit myself with one that I've been reporting with logs for months and can't download without a browser crash since version 82.x ... No one has even looked at the issue months later. Why report anything ? This is not an obscure issue -- I even suggested how to fix it, was ignored, meanwhile for months I have to turn to Chromium or terminal to download anything on Android, it's absurd.
With this last move removing in 85 the file:/// workaround for local browsing, me and my co-workers can't test offline documents on Android devices before moving them to production, open any local media files, or use our company's local wiki in-device.
I have been preaching for and promoting Firefox since it exists, but at this point it's painfully clear I'm in denial. I can't use it for anything right now.
Why are you doing all this ? I ask in earnest, do any of the current developers even use Fenix for anything other than browsing Facebook or Instagram these days ?
Edit : cadeyrn, you're extremely quick to give a thumbs down but why don't you comment instead ? Put yourself in my shoes. In our company we use TiddlyWiki among others, locally. A lot. How do you suggest we do that now in Android ? There is no other application but a browser to use a wiki. It is purposely made to be opened in a browser. These are not documents we can or want to put online. The only option is using another browser. In fact, ANY other Android browser, as Firefox is the only one that incomprehensively removes a fundamental browser function.
Edit 2 : I honestly, seriously, ask in earnest what current developers use Fenix for, daily, if they do. Just uninstalled Fenix and tried the last Fennec that was released to see if I am being dramatic. The answer is no. I know better than to run an outdated browser lacking vulnerability fixes, but the regression path of Fenix by comparison is shocking. Add-ons work in Fennec, so does downloading, opening local files, viewing source, anchor links, and the list goes on and on and on. List of essential functions that define what a browser is and are gone or broken in Fenix. Fennec gave any Chromium-based browser a run for its money. How on Earth is Fenix now this broken and more and more so with each decision like the one we're discussing here ? It makes no sense.
This was last point for me to switch to vivaldi. I have a great collection of local html files. I see no point to use firefox anymore. Your product management total sucks
that's why i stayed with firefox 68.12.Because it was more usable
I got several HTML documents on my phone which are bookmarked using file:///... links. Since today I cannot access these files anymore with Firefox mobile. This workaround using file:///... link instead of showing a "open with Firefox" from the file manager was cumbersome, but now even this workaround is gone without any notification.
I got several HTML documents on my phone which are bookmarked using file:///... links. Since today I cannot access these files anymore with Firefox mobile. This workaround using file:///... link instead of showing a "open with Firefox" from the file manager was cumbersome, but now even this workaround is gone without any notification.
just go back to firefox 68.Its more usable than fenix
How can I do that?
How can I do that?
Don't. Running a two year old browser is out of the question. You're putting yourself and others at risk.
If you need a functional browser, use a Chromium-based one ( Vivaldi, Bromite, Ungoogled Chromium ... ) until Fenix works.
Don't. Running a two year old browser is out of the question. You're putting yourself and others at risk.
You could use latest Fenix for regular browsing and an older Firefox version for file:// URLs.
How can I do that? go to fdroid and search fennec
What's the status of opening local files?
It's clearly an issue with significant community interest, but Mozilla seems to be ignoring it without providing any rationale.
What's the status of opening local files?
It's clearly an issue with significant community interest, but Mozilla seems to be ignoring it without providing any rationale.
Good point. There surely is a rationale, and there surely are people who know it. Could someone please explain ?
"There one was a security bug related to this which is now fixed, but let's remove a feature in the name of security since our users don't need much else from a browser other than loading Facebook"?
Found a hack which allows one to open local html files in latest stable firefox (86.x as of now).
One need to save a link to a local html file in collection. This was possible in Firefox 80.x: https://github.com/mozilla-mobile/fenix/releases/tag/v80.1.3 After file is saved under a collection, one can upgrade firefox to the latest version via play market, and the link from collection still works, as well as all other local html files linked from that file.
So the hack is to
- remove firefox via play market
- install firefox 80.x: https://github.com/mozilla-mobile/fenix/releases/tag/v80.1.3 (in my case that was https://github.com/mozilla-mobile/fenix/releases/download/v80.1.3/firefox_v80.1.3_arm.apk)
- grant storage access to firefox: android settings -> apps -> firefox -> permissions -> storage
- open local html file (in my case it is links.html which contains links to other local html files) - the file should open (one need to insert full path to a local file in firefox file:///storage/path/to/links.html)
- save that local html file to a collection
- upgrade firefox to the latest version via play market
- link to a local html file accessed via collection still works; links to all other local html files found in the one stored under collections work too. Updating the file contens does not break it.
Found a hack ...
This does not work for me. The collection and links in it survives the upgrade, sure. And with root file managing rights it's also easy enough to get the files and move them to any new device / install ( fixing rights appropriately ) but Firefox won't load a local file, it stays blank.
Not sure how or why it would work for you since loading local files is blocked, no matter from where. Regardless, it's ridiculous to have to resort to this, a browser that doesn't open local html files is broken, period.
There still seems to be a way to open local files in Fenix 86.1.1. If you setup remote debugging via USB, you can enter local URL (like file:///storage/emulated/0) in devtools toolbox's address bar (at PC) and Fenix opens it :) Of course practical usability of this workaround is close to none, but it shows that not everything has been secured...
A workaround is to access those local html files via a local webserver. https://play.google.com/store/apps/details?id=jp.ubi.common.http.server (from https://android.stackexchange.com/questions/220400/local-files-revisited-opening-local-html-files-file-path-to-file-in-chrome ) Life would be a bit easier without having to do so.
A workaround is to access those local html files via a local webserver. https://play.google.com/store/apps/details?id=jp.ubi.common.http.server (from https://android.stackexchange.com/questions/220400/local-files-revisited-opening-local-html-files-file-path-to-file-in-chrome ) Life would be a bit easier without having to do so.
Thank you ! In the link they say that the concept of "scoped storage" was the reason for chrome to implement these restrictions - but why is this a reason ? I mean, we don't want to access each and every file all over the place, but just files from a certain location ! What's the problem with that in scoped storage ?
Reminder: You can long press a link and download that HTML file in fenix
@wymiatacz thanks a lot for the workaround with remote debugging. It is the only way I found to fetch huge (doesn't fit Sync limit) open tabs list from Firefox@Android. Setting up own Sync server seems more complicated.
upd: seems like sessionstore.js is not used for tabs list storage now; looking for the current place
upd2: it's file:///data/user/0/org.mozilla.firefox/files/mozilla_components_session_storage_gecko
Browsing local files and opening HTML files works on my machine, with a small twist.
Write
file:///storage/emulated/0/on your address bar and notice the///. If you don't write the///your address bar will display it for you but it will show an error, even if you refresh the page. So make sure to have the///on the first try, or else open a new tab.Furthermore, once you have an HTML file opened, if you add it to your home screen, it won't be able to open it.
I use the lastest standard Firefox Preview from the Play Store on a Pixel 2 with Android 10.
Can anyone else confirm this behaviour on their device?
(Might be relevant for #4049 that is currently closed)
This almost works. When navigating to file:///storage/emulated/0/Documents/ it shows a blank folder, although there is an htm file there (accessible with the phones file manager). I'm on Samsung Galaxy A52, Android 11.
This could be reconsidered in the future but for now Fenix will not support loading
file://anymore. Let's keep this feature request open to reconsider the opportunity of this later.
Could you perhaps base your opinion or reconsider it?
We've gone from the UNIX philosophy "everything is a file" to the Android philosophy "nothing is a file" (or alternatively, "the filesystem is invisible") and I am not a happy camper.
The social engineering MO (according to #4049) for a hypothetical(?) malware infection through local HTML file seems to require persuading the mark to (1) save a file and then (2) open it from the filesystem. It would seem to me that a mark capable of acting on (2) would be sophisticated enough not to fall for (1), but who knows?
For now I've found Kamran Zafar's kWS Android Web Server to be a usable workaround. Interestingly, found the following in one of the reviews of that app:
I used this to access local html files from the browser which is no longer allowed in Android 10.
So it's not just a Firefox problem.