Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

387
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!