Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome on android - not loading local website javascript and css

I have strange problem on Chrome for Android with local website.

It works perfect on Firefox for Andorid, but not for Chrome.

On my site here: https://passcombo.com there is download link with a zip file.

What I do is:

  1. download file to local file system (not SSD! - external storage makes another problem!)
  2. I unzip the package and go to the site in local storage using File Commander
  3. I open the html file with Chrome - only HTML loads, no CSS, no JS, no images, no fonts.

Looks like there is path problem with relative paths?

But firefox works!

Working alternative is Firefox, but there you need to write correct strange path: "file:///storage/emulated/0/..../...html" But... Currently Chrome is mostly used on Andorid so it's bad local sites not working :/

like image 272
kkonrad Avatar asked Jan 02 '17 16:01

kkonrad


2 Answers

Seems like the only directory Chrome reads local files from is file:///sdcard/Android/data/com.android.chrome/files/Download/

like image 113
slpng Avatar answered Sep 24 '22 11:09

slpng


The only solution worked for me in Android is the HTTP Web Server (I used Simple HTTP Server).

Installing different browsers didn't help: (Apr-2021) I tried installing various Browsers (Chrome, FireFox, even Opera etc.) in Android but none worked. In all cases, when I navigated to the folder containing HTML/JS files using local file:/// URLs ('file:///sdcard/' or 'file:///storage/emulated/0/') browsers only displayed the folders but no files. When I used the absolute path to the HTML file the browsers used content:/// protocol to render static HTML content, i.e. it did NOT allow execution of JavaScript code.

like image 35
Eddie Kumar Avatar answered Sep 26 '22 11:09

Eddie Kumar