0

I wrote a .html file that uses css(style.css) and javascript(app.js). When I transferred the folder containing the index.html,style.css and app.js over to my android internal memory,the browser runs the html file but my .css and .js files are not detected.

            <!DOCTYPE html>
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <head>
            <link href="style.css" rel="stylesheet" >
            </head>
            <body>
             ....
            </body>
            <script src="app.js" charset="utf-8"></script>

I have tried using "/style.css" and "./style.css". But none of them are helping in detecting the files.

Inline styles in the index.html file work fine and show up in my browser.

Using Chrome on Android 8.1.0 (MIUI 10.1|Stable)

1 Answers1

0

You can load your files somewhere in your device like this :

  • file:///storage/emulated/0/MyDirectory/index.html
  • file:///storage/emulated/0/MyDirectory/style.css
  • file:///storage/emulated/0/MyDirectory/app.js

And then try to address thoes in src and href.


For testing purposes you can also use applications that let you run local servers on your device, like this one: https://play.google.com/store/apps/details?id=com.esminis.server.apache

Mohammad Zamanian
  • 751
  • 2
  • 7
  • 19
  • Tanks for answering ,however, it still doesn't help detect the files. Apparently, Chrome doesn't have the permission to read files .When I type in file:///storage in address bar, it shows me ERR_ACCESS_DENIED. – Pritish Nayak May 28 '19 at 18:33
  • https://play.google.com/store/apps/details?id=jp.ne.shira.html.viewer Using that app , the HTML file was able to run perfectly. – Pritish Nayak May 28 '19 at 18:39