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

235
Views
How to dynamically load a CSS file avoiding navigator cache

I've usually loaded CSS files with PHP by adding a GET variable that changes each time. For example the value of the microtime

But I need to dynamically load a CSS file avoiding navigator cache for see the continuous changes making in production development.

<?php echo '<link rel="stylesheet" type="text/css" href="myFile.css?v='.round(microtime(true)).'"></script>';?>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Sometimes you will need to load a dynamic file name as well. It is possible to do it without PHP like this:

<link rel="stylesheet" type="text/css" href="" id="myCSS">

<script>     
  var microTime = Date.now();   
  var myVar = "myCSSFile";
  var myUrl = myVar+'.css' + '?v=' + microTime;

  myCSS.href= myUrl;
</script>
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!