N
N
nak-alexey2018-06-12 12:01:01
JavaScript
nak-alexey, 2018-06-12 12:01:01

Why doesn't the browser see the local file path?

Hello! I am creating an application on PhoneGap and faced the following problem.
The application does not see local files that are in the same folder. Those. there is index.html and css files or any other files in the same directory. here they are not loading. And when I insert it directly, let's say the style tag in index.html then it works. I tried just as easy to drop the folder with the application on the USB flash drive and open the same song through the browser, as if there were no files. Tell me what to do? Tested on Android 7.0

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
deyen, 2018-06-12
@deyen

Use relative paths, not absolute ones.
For example, you have index.html, my.js, style.css files.
So in index.html you should write the following

<head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <link href="./style.css" rel="stylesheet">
        <script src="./my.js"></script>
</head>

Don't forget to include !DOCTYPE before

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question