-1
The code below only works on localhost , online does not work, that is, it works perfectly on my machine, when I transfer to the server , none of it works, I already broke my head and could not solve.
DETAIL! - The arquivo.js
is within the root directory of http://loacalhost
no intermediate paths, note:
<script type="text/javascript" language="javascript" src="arquivo.js"></script>
<script type="text/javascript" language="javascript" src="/arquivo.js"></script>
<script type="text/javascript" language="javascript" src="../arquivo.js"></script>
I performed local tests, with the three types mentioned above and all did well. Already in the server http://xpg.uol.com.br
I have done likewise leaving it at the root, but without success.
In a new attempt, I included the content of arquivo.js
within the HTML document (page index.html
), even so, no chance.
In another attempt with absolute path, related to server configuration, where:
<script type="text/javascript" language="javascript" src="http://meusite.xpg.uol.com.br/arquivo.js"></script>
.. legal funf when put in localhost
otherwise ... no way.
Anyway, it seems to me to be in the scope of the function or even in the placement of the same on the page.
I would like to understand where I am going wrong. I thank you from now on, help from all.
It has to do with relative paths and server configuration, to solve this use absolute path, i.e.: www.meusite.pt/public/js/bootstrap.js
– Fábio
How is the url in import production?
– Matheus
Hello, On putting in the same page folder and using <script type="text/javascript" language="javascript" src="file.js"></script> does not work? what is the error in the console?
– Tiago Gomes
If you’re using Chrome, press F12 and see if there’s a white x dot showing errors, click on it and say what appears.
– Bruno Romualdo