Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

389
Vistas
Html cannot load javascript?

I'm sorry about the fact that I'm a newbie, if the question is not clear, please notify me again, I will add information. I have a sample code , but it cannot load js. Can someone tell me how to solve?

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <script src="/js/signalr.js"></script>
    <script src="/js/Cnn.js"></script>
    <title></title>
</head>
<body>
    <h1>Qoo</h1>
</body>
</html>

the error:

Failed to load resource: net::ERR_FILE_NOT_FOUND

enter image description here

enter image description here

And I have try this way,but it still cannot work

<script src="/wwwroot/js/signalr.js"></script>

or

<script src="~/js/signalr.js"></script>
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

It all depends on where the HTML file is, relative to the JS file.

If the index file is in the root of that folder and the JS in a sub-folder, the correct code would be:

<script src="js/signalr.js"></script>

The above code uses a relative URL as does your code however, your code is relative to the root directory and my example is relative to your current working directory.

If your URL in the browser has a driver letter at the start of it, then the JS would be loaded from a JS sub-folder in the root of that drive. For example, if the URL is C:\wwwroot\index.html then the browser would attempt to load the JS file from C:\js\signalr.js rather than C:\wwwroot\js\signalr.js, where the latter is the correct location.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda