• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Open local files in browser

bmcorum

Lurker
Nov 9, 2011
1
0
I need to be able to open a html file that is located in the root directory. I have read several post that state you can access file on the sdcard through the browser using 'file://sdcard/pathToFile' I assumed since the file I need to load is located at the root I need only use 'file://pathToFile'. In my root folder there is a file name 'hello.html' therefore I enter 'file://hello.html' into the address bar of the browser and get a 'no such file or directory' error. I verified the file does in fact exist at root/hello.html. What am I doing wrong? I have tried 'file:///hello.html' as well.
 
I suspect your browser does not have the capability to look anywhere but /sdcard. That's just how it was programmed. And you do realize that any file you put at the root level will be gone at next reboot, right? You should put your files in the /sdcard mount and access it via file:///sdcard/yourfolder/yourfile.html


BTW, welcome to the forums! :)
 
Upvote 0
I need to be able to open a html file that is located in the root directory. I have read several post that state you can access file on the sdcard through the browser using 'file://sdcard/pathToFile' I assumed since the file I need to load is located at the root I need only use 'file://pathToFile'. In my root folder there is a file name 'hello.html' therefore I enter 'file://hello.html' into the address bar of the browser and get a 'no such file or directory' error. I verified the file does in fact exist at root/hello.html. What am I doing wrong? I have tried 'file:///hello.html' as well.
Not knowing if you're using the default Android browser or what, this might not be the solution you're looking for but for the Firefox for Android browser there's an addon called 'Open Local File'. It adds a 'Open Local File' option to Firefox's 'Tools' menu.
https://addons.mozilla.org/en-US/android/addon/open-local-file/
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones