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

124
Views
What makes a source script not loading and then loading again?

When using a <script> tag with src attribute one should expect it to download:

<script src="https://unpkg.com/neovis.js@2.0.0-alpha.9/dist/neovis.js"></script>

However recently it fails to download, and I fail to locate the reason why it becomes so. The possibly reliable fix is that when that happens, I change it to:

<script>
function cdnLoaded() {
    console.log('loaded');
}
function cdnError() {
    console.log('not loaded');
    // do error handling here
}
</script>    
<script onload="cdnLoaded()" onerror="cdnError()" async src="https://unpkg.com/neovis.js@2.0.0-alpha.9/dist/neovis.js"></script>

At this point, the console says it's loaded but actually it's not. But after that when I revert it back to:

<script src="https://unpkg.com/neovis.js@2.0.0-alpha.9/dist/neovis.js"></script>

then it works again. This has happened twice in two browsers (Edge and Firefox), and I haven't had a chance to test it again.

What can be the reason for this strange behavior? Could this be a kind of caching?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Browser cache scripts by filename. Probably adding/removing onload and onerror properties force the browser to download the script again.

To force file reload you could apply a versioning

<script src="util.js?v=1"></script>

Modern frameworks use to join, minify and rename script file automatically. You can do it with tools like webpack

about 4 years ago · Juan Pablo Isaza 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!