Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML force refresh

I've just finish a redesign/reskin of a website that's been up for over a year. New html, new css, new images.

How can I force all visitors to refresh their cache so they don't try to look up last year's assets and get a broken page?

I've read about META refresh but this doesn't seem like the right solution. Is this my only option?

like image 538
Greg B Avatar asked May 06 '26 00:05

Greg B


1 Answers

simply adding a query-string to the include will make the browser think that its a new file and you won't have to change the name or even update it on all pages at once.

example

   <script type="text/javascript" src="myfile.js?v=123"></script>
   <link href="cssfile.css?v=321" rel="stylesheet" type="text/css" />
like image 144
Josh Avatar answered May 08 '26 17:05

Josh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!